using System.Collections.Generic; using Kreta.Ellenorzo.Domain.VN.Interfaces; using Kreta.Ellenorzo.Domain.VN.Logic; namespace Kreta.Ellenorzo.Domain.VN.UniqueIdentifier { public class CsatolmanyUid : IReadonlyUidRaw, IEqualityComparer { public CsatolmanyUid(int id) { Id = id; UidRaw = id.ToString(); } public CsatolmanyUid(string uidRaw) { var compositeKeyElements = UidLogic.GetCompositeKeyElements(uidRaw); Id = int.Parse(compositeKeyElements[0]); UidRaw = uidRaw; } public int Id { get; private set; } public string UidRaw { get; private set; } public bool Equals(CsatolmanyUid x, CsatolmanyUid y) => x == y || x.UidRaw == y.UidRaw; public int GetHashCode(CsatolmanyUid obj) => obj.UidRaw.GetHashCode(); } }