Skip to content

Latest commit

 

History

History
37 lines (31 loc) · 883 Bytes

File metadata and controls

37 lines (31 loc) · 883 Bytes

FluentUtils.ValueObject

Example Usage

Inherit ValueObject and implement the GetEqualityComponents method.

public class Street : ValueObject
{
    public string? Unit { get; set; }
    public string? Number { get; set; }
    public string? Name { get; set;  }

    protected override IEnumerable<object?> GetEqualityComponents()
    {
        yield return Unit;
        yield return Number;
        yield return Name;
    }
}

public class Address : ValueObject
{
    public Street? Street { get; set; }
    public string? City { get; set; }
    public string? State { get; set; }
    public string? PostCode { get; set; }

    protected override IEnumerable<object?> GetEqualityComponents()
    {
        yield return Street;
        yield return City;
        yield return State;
        yield return PostCode;
    }
}