Salmon/Salmon.Core/Element.cs
2024-04-11 21:30:36 +02:00

46 lines
1.1 KiB
C#

using Salmon.Core.Cliff;
namespace Salmon.Core;
public class Element
{
//Should not persist, only for convenient use (ex: Json serialization)
public string? LastType { get; set; }
[IdentifierField]
public string UniqueId { get; }
[PersistentField("parent")]
public string? ParentId { get; set; }
[PersistentField]
public string? ShortName { get; set; }
[PersistentField]
public string? LongName { get; set; }
[PersistentField]
public string? Description { get; set; }
#pragma warning disable CS8618 // for autoconstruct
protected Element()
#pragma warning restore CS8618
{
}
public Element(string id)
{
UniqueId = id;
LastType = GetType().Name;
}
public Dictionary<string, object> SupplementaryProperties = new Dictionary<string, object>();
public virtual IEnumerable<KeyValuePair<string, object>> ImportantProperties()
{
/*if (ParentId != null)
yield return KeyValuePair.Create<string, object>(nameof(ParentId), ParentId);*/
yield break;
}
}