init
This commit is contained in:
@@ -0,0 +1,34 @@
|
||||
using System.Collections.Generic;
|
||||
using Kreta.Ellenorzo.Domain.VN.Interfaces;
|
||||
using Kreta.Ellenorzo.Domain.VN.Logic;
|
||||
|
||||
namespace Kreta.Ellenorzo.Domain.VN.UniqueIdentifier
|
||||
{
|
||||
public class TanevRendjeUid : IReadonlyUidRaw, IEqualityComparer<TanevRendjeUid>
|
||||
{
|
||||
public TanevRendjeUid(int id, int? osztalyCsoportId)
|
||||
{
|
||||
Id = id;
|
||||
OsztalyCsoportId = osztalyCsoportId;
|
||||
UidRaw = UidLogic.Concat(id, osztalyCsoportId);
|
||||
}
|
||||
|
||||
public TanevRendjeUid(string uidRaw)
|
||||
{
|
||||
var compositeKeyElements = UidLogic.GetCompositeKeyElements(uidRaw);
|
||||
Id = int.Parse(compositeKeyElements[0]);
|
||||
OsztalyCsoportId = int.TryParse(compositeKeyElements[1], out var result) ? (int?)result : null;
|
||||
UidRaw = uidRaw;
|
||||
}
|
||||
|
||||
public int Id { get; private set; }
|
||||
|
||||
public int? OsztalyCsoportId { get; private set; }
|
||||
|
||||
public string UidRaw { get; private set; }
|
||||
|
||||
public bool Equals(TanevRendjeUid x, TanevRendjeUid y) => x == y || x.UidRaw == y.UidRaw;
|
||||
|
||||
public int GetHashCode(TanevRendjeUid obj) => obj.UidRaw.GetHashCode();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user