This commit is contained in:
2024-03-10 20:10:05 +00:00
parent 89e1b5a235
commit d6180aa154
24 changed files with 255 additions and 78 deletions

48
src/isn.abst/Permalink.cs Normal file
View File

@ -0,0 +1,48 @@
using Newtonsoft.Json;
namespace isnd.Data.Catalog
{
public abstract class Permalink
{
public Permalink(string id, string type)
{
Type = type;
this.id = id;
}
public Permalink(string id)
{
Type = GetType().Name;
this.id = id;
}
[JsonProperty("@type")]
public virtual string Type { get; set; }
[JsonProperty("@id")]
public string Id { get => id; }
private readonly string id;
public string GetId() { return id; }
public override bool Equals(object obj)
{
if (obj!=null)
{
if (GetType().IsAssignableFrom(obj.GetType()))
{
var rpobj = (Permalink) obj;
return this.id == rpobj.id;
}
}
return base.Equals(obj);
}
public override int GetHashCode()
{
return id.GetHashCode();
}
}
}