Interface IBaseEntity
This is the base interface all entities within LemonEdge must implement.
All the properties on this base interface are implemented by *every* entity in LemonEdge, and thus exist as columns for every table in the database
Inherited Members
Namespace: LemonEdge.API.Entities
Assembly: LemonEdge.API.dll
Syntax
[EntityIndex(Name = "CanvasItem", ColumnNames = new string[] { "CanvasID", "ID", "AccountID" }, IndexOrder = new IndexOrder[] { IndexOrder.Ascending, IndexOrder.Ascending, IndexOrder.Ascending }, IsClustered = false, IsUnique = true)]
[EntityIndex(Name = "UniqueItem", ColumnNames = new string[] { "ID", "CanvasID", "AccountID" }, IndexOrder = new IndexOrder[] { IndexOrder.Ascending, IndexOrder.Ascending, IndexOrder.Ascending }, IncludeColumns = new string[] { "LastUpdated" }, IsClustered = false, IsUnique = true)]
public interface IBaseEntity : IEquatable<IBaseEntity>, INotifyPropertyChanged, INotifyPropertyChanging, ICloneableAsync, ICanTrackProperties
Properties
AccountID
Links to UniqueAccountID. LemonEdge is a multi-tenanted system, and thus you can have several different accounts all residing in the same database
The default root account is 1
This property holds the account the item belongs to. It can not be modified by a user, it is maintained internally by the system
Declaration
[EntityProperty(SQLType.BigInt, false)]
long AccountID { get; set; }
Property Value
Type | Description |
---|---|
long |
AlgorithmStepID
Links to IAlgorithmRunStep. Holds the ID of the algorithm step that created or updated this record
Declaration
[EntityProperty(SQLType.UniqueIdentifier, true)]
[EntityRelationship(EntityID.AlgorithmRunStep, "ID", SingleJoinType.ZeroToOne, "Algorithm Step", "Updated From Algorithm Step", DeleteWithRelationship = false, PartOfParentSet = false, LinkToItemInSet = false, PreventAutoConstraint = true)]
Guid? AlgorithmStepID { get; set; }
Property Value
Type | Description |
---|---|
Guid? |
CanvasID
Links to ICanvas. If this record is within a canvas, this holds the canvas id for the record.
By ensuring all items in the system have a canvas property, we can guarantee a mechanism for isolating canvases and ensuring all entities are compatabile with them
Declaration
[EntityProperty(SQLType.UniqueIdentifier, true)]
[EntityRelationship(EntityID.Canvas, "ID", SingleJoinType.ZeroToOne, "Canvas", "Contained In Canvas", DeleteWithRelationship = true, PartOfParentSet = false, LinkToItemInSet = false, PreventAutoConstraint = true)]
Guid? CanvasID { get; set; }
Property Value
Type | Description |
---|---|
Guid? |
ID
All items in the system have a globally unique id.
This is used instead of auto-increment numbers for several reasons, but the main one being it enables all entities to be designed to cope with importing/exporting/copying. It is very easy to create an entire copy of an account into another one by maintaining the same ids
Declaration
[EntityProperty(SQLType.UniqueIdentifier, false)]
Guid ID { get; set; }
Property Value
Type | Description |
---|---|
Guid |
LastUpdated
The server datetime stamps of when this item was last udpated in the system
By ensuring every record has a datetimestamp for changes, and by keeping all old records, we can ensure the entire system can be ran as of any point in time in the past
Declaration
[EntityProperty(SQLType.DateTimeOffset, false)]
DateTimeOffset LastUpdated { get; set; }
Property Value
Type | Description |
---|---|
DateTimeOffset |
Remarks
We should always use datetimeoffsets. They are international, with time zones, but most importantly odata supports them and not datetime
ModifiedByUserID
Links to IUser. This holds the id of the user that made the change to the item
Declaration
[EntityProperty(SQLType.UniqueIdentifier, false, FriendlyLabel = "Modified By User")]
[EntityRelationship(EntityID.Users, "ID", SingleJoinType.One, "Modified By User", "User Modified", LinkToItemInSet = false)]
Guid ModifiedByUserID { get; set; }
Property Value
Type | Description |
---|---|
Guid |
SafeID
Links to ISafe. If this record is within a safe, this holds the safe id for the record.
By ensuring all items in the system have a safe property, we can guarantee a mechanism for isolating items and ensuring they are only seen by permitted users
Declaration
[EntityProperty(SQLType.UniqueIdentifier, true)]
[EntityRelationship(EntityID.Safe, "ID", SingleJoinType.ZeroToOne, "Safe", "Contained In Safe", DeleteWithRelationship = false, PartOfParentSet = false, LinkToItemInSet = false, PreventAutoConstraint = true)]
[DBTrackChanges]
Guid? SafeID { get; set; }
Property Value
Type | Description |
---|---|
Guid? |
Methods
GetLabel(string)
For properties that are Guid properties holding a relationship to another entity, this function returns the label held for that id
This is done by the class that implements this interface holding a xxx_Label property for every xxx Guid relationship property with a label
Declaration
string GetLabel(string propName)
Parameters
Type | Name | Description |
---|---|---|
string | propName | The Guid relationship property name to return the label for that item of |
Returns
Type | Description |
---|---|
string | The label held for the specified guid relationship property |
SetLabel(string, string)
For properties that are Guid properties holding a relationship to another entity, this function can be used to set the label held for that id
This is used throughout the client UI by the platform to update the labels held when users choose different items for relationships so the UI immediately reflects these choices
This is done by the class that implements this interface holding a xxx_Label property for every xxx Guid relationship property with a label
Declaration
void SetLabel(string propName, string value)
Parameters
Type | Name | Description |
---|---|---|
string | propName | The Guid relationship property name to update the label for that item of |
string | value | The new label value for the corrosponding property id |
SetSilentLabel(string, string)
The same as SetLabel(string, string) except done without raising any INotifyPropertyChanged events
Declaration
void SetSilentLabel(string propName, string value)
Parameters
Type | Name | Description |
---|---|---|
string | propName | The Guid relationship property name to update the label for that item of |
string | value | The new label value for the corrosponding property id |