Search Results for

    Show / Hide Table of Contents

    Class BaseEntity

    The base class that every system implementation of IBaseEntity inherits from

    Inheritance
    object
    BaseEntity
    TeamDefaultPermission
    TeamDefaultTeamPermission
    UserRole
    UserTeam
    BaseEntityWithPermissions
    CanvasItemApproval
    CanvasPromotedItem
    CanvasPromotion
    EntityTag
    GroupingItem
    SafeEntityType
    SafeTeam
    DataMappingProperty
    DataSourceID
    ImportDefinitionStep
    ReconciliationSource
    ReconciliationSourceColumn
    AddIn
    AlgorithmData
    AlgorithmOutput
    AlgorithmRunData
    AlgorithmRunStep
    AlgorithmSheetModifier
    AlgorithmStepDataCopier
    CustomGridColumn
    CustomListItem
    CustomObjectIndex
    CustomObjectIndexColumn
    CustomObjectProperty
    CustomViewControl
    LayoutRole
    MenuItem
    CapitalAccountDataItem
    EntityPeriodClosing
    GLAccountName
    GLClassificationName
    GLPosting
    GLPostingAllocated
    GLPostingPathSplit
    GLRollupClassification
    GLRollupHeader
    InstrumentCapitalAccountDataSetting
    PeriodEndAdjustment
    PeriodEndTransactionLink
    PeriodEndTransformationItem
    PeriodEndTransformationItemOffset
    CompanyOwnership
    ContactInfo
    Employee
    EntityLedger
    EntitySetChartOfAccount
    EntityTransactionCode
    HolidayCalendar
    SetEntity
    CollateralItem
    CoverageItem
    ExchangeRate
    InstrumentSetItem
    LinkedInstrument
    LoanInfoHoliday
    LoanSchedule
    ObjectEntityRate
    Rate
    AllocationAmount
    AllocationPathRule
    AllocationPathSplitDynamicUpdate
    BlendTransactionInstrumentSet
    BlendingTransactionInstrumentValue
    BlendingTransactionNewValue
    BlendingTransactionNewValueAggregate
    BlendingTransactionNewValueAllocation
    CompiledPath
    SplitTransactionLine
    SplitTransactionSwitch
    StepChangeAlgorithm
    StepChangeMovement
    StepChangeRebalance
    TransactionAggregatorOn
    TransactionAllocated
    TransactionCodeAllocateToTransaction
    TransactionCodeAllocateToTransactionValue
    TransactionCodeDependant
    TransactionCodeGLEntry
    TransactionCodeProcessor
    TransactionCodeValue
    TransactionMatcherOn
    TransactionPathSplit
    TransactionTypeValue
    TransferEntityOverride
    TransferTargetPartner
    TransferTransactionTypeValueOverride
    Answer
    AnswerCreator
    Question
    DataTemplateAttachment
    DatasetQueryableItem
    DatasetQueryableItemFieldInfo
    DatasetQueryableItemJoin
    DatasetShortcutOverride
    ExpressReportDataSet
    ExpressReportDataSetParameter
    ExpressReportRelationship
    ExpressReportRelationshipColumn
    FilterDescriptor
    PivotFieldInfo
    QueryRunnerStep
    QueryRunnerStepParameter
    SQLFunction
    SQLTypeWrapper
    SQLWrapperChain
    SQLWrapperChainLink
    SQLWrapperDependant
    SQLWrapperStat
    VennSetQueryableItem
    VennSetQueryableItemFieldInfo
    VennSetQueryableItemParam
    ServerTaskData
    ServerTaskModifiedItem
    ServerTaskStatus
    ArticleOwner
    DefaultWatcher
    DocumentAttachment
    DocumentCategory
    DocumentOwner
    TagType
    Watcher
    APIQuery
    Implements
    IBaseEntity
    IEquatable<IBaseEntity>
    INotifyPropertyChanged
    INotifyPropertyChanging
    ICloneableAsync
    ICanTrackProperties
    Inherited Members
    object.GetType()
    object.MemberwiseClone()
    object.ToString()
    object.Equals(object, object)
    object.ReferenceEquals(object, object)
    Namespace: LemonEdge.API.Entities
    Assembly: LemonEdge.API.dll
    Syntax
    [DataContract]
    public abstract class BaseEntity : IBaseEntity, IEquatable<IBaseEntity>, INotifyPropertyChanged, INotifyPropertyChanging, ICloneableAsync, ICanTrackProperties
    Remarks

    If using our auto-code designers, or other tools the system will always create entities for you that inherit this base class. These correctly implement all the LemonEdge technology such as the following interfaces:

    • entityUpdateContext: Holds an instance of IEntityUpdater
    • IBaseEntity: The base entity interface implementation
    • INotifyPropertyChanging: Ensures all property changes are correctly raised to listeners
    • INotifyPropertyChanged: Ensures all property changes are correctly raised to listeners
    • ICloneableAsync: Ensures this entity can be cloned, and have all its property values copied

    You are however free to completely implement your own base class as long as it implements all the required interfaces

    Constructors

    BaseEntity()

    Declaration
    protected BaseEntity()

    Fields

    HISTORY_ENDROWUPDATE_COLNAME

    The name reserved by the system for the column holding change dates for the auditing table

    For every entity in the system that has a table created in the database, it also has an associated audit table

    Declaration
    public const string HISTORY_ENDROWUPDATE_COLNAME = "EndUpdated"
    Field Value
    Type Description
    string

    Properties

    AccountID

    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
    public long AccountID { get; set; }
    Property Value
    Type Description
    long

    AlgorithmStepID

    Holds the link to the algorithm step that updated or created this record

    Declaration
    public Guid? AlgorithmStepID { get; set; }
    Property Value
    Type Description
    Guid?

    AlgorithmStepID_Label

    If this record was created/updated from algorithm step, this holds the algorithm step label for the record

    Declaration
    public string AlgorithmStepID_Label { get; set; }
    Property Value
    Type Description
    string

    AlgorithmStepID_Label_Silent

    Declaration
    public string AlgorithmStepID_Label_Silent { get; set; }
    Property Value
    Type Description
    string

    CanvasID

    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
    public Guid? CanvasID { get; set; }
    Property Value
    Type Description
    Guid?

    CanvasID_Label

    If this record is within a canvas, this holds the canvas label for the record

    Declaration
    public string CanvasID_Label { get; set; }
    Property Value
    Type Description
    string

    CanvasID_Label_Silent

    Declaration
    public string CanvasID_Label_Silent { get; set; }
    Property Value
    Type Description
    string

    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
    public 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
    public 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

    This holds the id of the user that made the change to the item

    Declaration
    public Guid ModifiedByUserID { get; set; }
    Property Value
    Type Description
    Guid

    ModifiedByUserID_Label

    This holds the name of the user that made the change to the item

    Declaration
    public string ModifiedByUserID_Label { get; set; }
    Property Value
    Type Description
    string

    ModifiedByUserID_Label_Silent

    Declaration
    public string ModifiedByUserID_Label_Silent { get; set; }
    Property Value
    Type Description
    string

    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
    public Guid? SafeID { get; set; }
    Property Value
    Type Description
    Guid?

    SafeID_Label

    If this record is within a safe, this holds the safe label for the record

    Declaration
    public string SafeID_Label { get; set; }
    Property Value
    Type Description
    string

    SafeID_Label_Silent

    Declaration
    public string SafeID_Label_Silent { get; set; }
    Property Value
    Type Description
    string

    TrackChanges

    By default, no changes are tracked. Only services directly connecting to the db should track property changes.

    Declaration
    public static bool TrackChanges { get; set; }
    Property Value
    Type Description
    bool

    Methods

    AddTrackedOriginalValue(string, object)

    Should be called whenever a tracked property has its value changed. This ensures the original value is tracked along with the fact it has changed.

    Declaration
    protected void AddTrackedOriginalValue(string propName, object value)
    Parameters
    Type Name Description
    string propName
    object value

    ClearTrackedOriginalValues()

    Clears all records of the tracked changes against this entity.

    Note: It does *not* reset any changed values back to their original values ( ResetChangedTrackedPropertiesToOriginalValues() does that), it simply clears the tracking of those changes

    Declaration
    public void ClearTrackedOriginalValues()

    Clone(object)

    ICloneableAsync implementation - Creates a new instance of this class with all the same property values as this instance

    Declaration
    public Task<object> Clone(object context)
    Parameters
    Type Name Description
    object context

    A context item used for creating a new instance of this item. Can allow permission checks and other functionality.

    Returns
    Type Description
    Task<object>

    A task that creates new instance of this class with all the same property values as this instance

    CopyFromEntity(IBaseEntity)

    Declaration
    protected virtual void CopyFromEntity(IBaseEntity source)
    Parameters
    Type Name Description
    IBaseEntity source

    CopyFromSource(object)

    ICloneableAsync implementation - Updates all properties in this item to have the same properties as the source object.

    The source object should be of the same type as this one

    Declaration
    public void CopyFromSource(object source)
    Parameters
    Type Name Description
    object source

    The source object to copy all values from. Should be of the same type as this one.

    Equals(IBaseEntity)

    IEquatable implementation of Equals, evaluating if the ID matches

    Declaration
    public virtual bool Equals(IBaseEntity other)
    Parameters
    Type Name Description
    IBaseEntity other

    The other IBaseEntity to compare on IDs

    Returns
    Type Description
    bool

    True if the IDs match

    Equals(object)

    IEquatable implementation of Equals, evaluating if the ID matches

    Declaration
    public override bool Equals(object obj)
    Parameters
    Type Name Description
    object obj

    The other IBaseEntity to compare on IDs

    Returns
    Type Description
    bool

    True if the IDs match

    Overrides
    object.Equals(object)

    GetAllOriginalTrackedPropertyValues()

    For all properties that are marked to track values (indicated with DBTrackChangesAttribute), this returns the a dictionary of property name and associated original unchanged value for properties that have had their value changed

    Declaration
    public IReadOnlyDictionary<string, object> GetAllOriginalTrackedPropertyValues()
    Returns
    Type Description
    IReadOnlyDictionary<string, object>

    A dictionary of property name and associated original value for properties that have had their value changed

    GetHashCode()

    Returns a hashcode for this entity based on the ID

    Declaration
    public override int GetHashCode()
    Returns
    Type Description
    int

    A hashcode for this entity based on the ID

    Overrides
    object.GetHashCode()

    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
    public 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

    HasTrackedPropertyChanged(string)

    Indicates if a tracked property (indicated with DBTrackChangesAttribute) has had its value changed

    Declaration
    public bool HasTrackedPropertyChanged(string propName)
    Parameters
    Type Name Description
    string propName

    The name of the property to check if its value has changed

    Returns
    Type Description
    bool

    True if a tracked property (indicated with DBTrackChangesAttribute) has had its value changed

    IsBasePropertyName(string)

    Returns true if the specified property name is one of the core base properties specified in IBaseEntity

    Declaration
    public static bool IsBasePropertyName(string name)
    Parameters
    Type Name Description
    string name

    The name of the property on an entity

    Returns
    Type Description
    bool

    True if the specified property name is one of the core base properties specified in IBaseEntity

    IsBaseRelationshipID(string)

    Returns true if the specified property is one of the core base properties specified in IBaseEntity that is a relationship property

    Declaration
    public static bool IsBaseRelationshipID(string name)
    Parameters
    Type Name Description
    string name

    The name of the property on an entity

    Returns
    Type Description
    bool

    True if the specified property is one of the core base properties specified in IBaseEntity that is a relationship property

    OnPropertyChanged(string)

    Notifies any INotifyPropertyChanged listeners

    Declaration
    protected virtual void OnPropertyChanged(string propName)
    Parameters
    Type Name Description
    string propName

    The property that is changing its value

    OnPropertyChanging(string)

    Notifies any INotifyPropertyChanging listeners

    Declaration
    protected void OnPropertyChanging(string propName)
    Parameters
    Type Name Description
    string propName

    The property that is changing its value

    OriginalTrackedPropertyValue(string)

    Returns the original value of a property that has its value tracked (indicated with DBTrackChangesAttribute) before any changes

    Declaration
    public object OriginalTrackedPropertyValue(string propName)
    Parameters
    Type Name Description
    string propName

    The name of the property to return the original value for

    Returns
    Type Description
    object

    The original value of a property that has its value tracked (indicated with DBTrackChangesAttribute) before any changes

    Remarks

    Will throw an error if the property has not changed value and still has its original value

    OriginalTrackedPropertyValue<T>(string)

    Returns the original value of a property that has its value tracked (indicated with DBTrackChangesAttribute) before any changes

    Declaration
    public T OriginalTrackedPropertyValue<T>(string propName)
    Parameters
    Type Name Description
    string propName

    The name of the property to return the original value for

    Returns
    Type Description
    T

    The original value of a property that has its value tracked (indicated with DBTrackChangesAttribute) before any changes

    Type Parameters
    Name Description
    T

    The type to return the property value as. Should match the actual type of the property.

    Remarks

    Will throw an error if the property has not changed value and still has its original value

    ResetChangedTrackedPropertiesToOriginalValues()

    For each tracked property (indicated with DBTrackChangesAttribute) that has had its value changed this will reset that change back to the original value and then call ClearTrackedOriginalValues()

    Declaration
    public Dictionary<string, object> ResetChangedTrackedPropertiesToOriginalValues()
    Returns
    Type Description
    Dictionary<string, object>

    A snapshot of all the values that were changed before they are reset -> the property name and its changed value

    RestoreFromSnapshot(Dictionary<string, object>)

    Restores all properties for this entity using the provided dictionary of property name and values

    Declaration
    public void RestoreFromSnapshot(Dictionary<string, object> snapshot)
    Parameters
    Type Name Description
    Dictionary<string, object> snapshot

    A complete list of all properties and associated values

    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
    public 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
    public 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

    SnapshotProperties()

    Returns a snap shot of all the property values against this entity as a dictionary of property name/value

    Declaration
    public Dictionary<string, object> SnapshotProperties()
    Returns
    Type Description
    Dictionary<string, object>

    A snap shot of all the property values against this entity as a dictionary of property name/value

    Events

    PropertyChanged

    INotifyPropertyChanged Implementation

    Declaration
    public event PropertyChangedEventHandler PropertyChanged
    Event Type
    Type Description
    PropertyChangedEventHandler

    PropertyChanging

    INotifyPropertyChanging Implementation

    Declaration
    public event PropertyChangingEventHandler PropertyChanging
    Event Type
    Type Description
    PropertyChangingEventHandler

    Implements

    IBaseEntity
    IEquatable<T>
    INotifyPropertyChanged
    INotifyPropertyChanging
    ICloneableAsync
    ICanTrackProperties

    Extension Methods

    LinqExtensions.AsArray<T>(T)
    LinqExtensions.ToArrayOfOne<T>(T)
    LinqExtensions.ToListOfOne<T>(T)
    MiscExtensions.SetIfNotEqual<T, TP>(T, Expression<Func<T, TP>>, TP)
    WeakReferenceExtensions.WeakReference(object)
    SQLExtensions.ToSQLValue(object, bool)
    ReflectionExtensions.ClearEventInvocations(object, string)
    StringExtensions.ToCSVFormatString(object, Type)
    In this article
    Back to top © LemonEdge Technologies. All rights reserved.