REORG
This commit is contained in:
48
src/isn.abst/Permalink.cs
Normal file
48
src/isn.abst/Permalink.cs
Normal 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();
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user