init
This commit is contained in:
@@ -0,0 +1,38 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Kreta.Ellenorzo.Domain.VN.Interfaces;
|
||||
|
||||
namespace Kreta.Ellenorzo.Domain.VN.UniqueIdentifier
|
||||
{
|
||||
[Serializable]
|
||||
public sealed class TantargyUid : IReadonlyUidRaw, IEqualityComparer<TantargyUid>, IEquatable<TantargyUid>
|
||||
{
|
||||
public TantargyUid(int id)
|
||||
{
|
||||
Id = id;
|
||||
UidRaw = id.ToString();
|
||||
}
|
||||
|
||||
public TantargyUid(string uidRaw)
|
||||
{
|
||||
// Magatartás, Szorgalom tantárgyak miatt van 0-ás Id
|
||||
Id = int.TryParse(uidRaw, out int result) ? result : 0;
|
||||
UidRaw = uidRaw;
|
||||
}
|
||||
|
||||
public TantargyUid()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public int Id { get; private set; }
|
||||
|
||||
public string UidRaw { get; private set; }
|
||||
|
||||
public bool Equals(TantargyUid x, TantargyUid y) => x == y || x.UidRaw == y.UidRaw;
|
||||
|
||||
public bool Equals(TantargyUid y) => this == y || UidRaw == y.UidRaw;
|
||||
|
||||
public int GetHashCode(TantargyUid obj) => obj.UidRaw.GetHashCode();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user