Open Source Web Application Framework for ASP.NET Core
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

63 lines
1.2 KiB

using System;
using System.Collections.Generic;
namespace Volo.Abp.Domain.Values;
public class AddressWithZipCode : ValueObject
{
public Guid CityId { get; }
public string Street { get; }
public int Number { get; }
public ZipCode ZipCode { get; }
public string[] Tags { get; }
private AddressWithZipCode()
{
}
public AddressWithZipCode(
Guid cityId,
string street,
int number,
ZipCode zipCode,
params string[] tags)
{
CityId = cityId;
Street = street;
Number = number;
ZipCode = zipCode;
Tags = tags;
}
//Requires to implement this method to return properties.
protected override IEnumerable<object> GetAtomicValues()
{
yield return Street;
yield return CityId;
yield return Number;
yield return ZipCode;
foreach (var tag in Tags)
{
yield return tag;
}
}
}
public class ZipCode : ValueObject
{
public string Code { get; }
public ZipCode(string code)
{
Code = code;
}
protected override IEnumerable<object> GetAtomicValues()
{
yield return Code;
}
}