Search Results for

    Show / Hide Table of Contents

    Class ColumnDescriptor

    This holds the definition of a column (including its SQL definition) against an entity.

    This is defined against an entity interface on the property using the EntityPropertyAttribute

    Inheritance
    object
    ColumnDescriptor
    Implements
    IEquatable<ColumnDescriptor>
    ICloneable<ColumnDescriptor>
    ICloneable
    Inherited Members
    object.GetType()
    object.MemberwiseClone()
    object.Equals(object, object)
    object.ReferenceEquals(object, object)
    Namespace: LemonEdge.API.Descriptors
    Assembly: LemonEdge.API.dll
    Syntax
    [DataContract]
    public class ColumnDescriptor : IEquatable<ColumnDescriptor>, ICloneable<ColumnDescriptor>, ICloneable

    Constructors

    ColumnDescriptor(PropertyInfo)

    Creates a new description of a property

    Declaration
    public ColumnDescriptor(PropertyInfo propInfo)
    Parameters
    Type Name Description
    PropertyInfo propInfo

    The see PropertyInfo of the property ascertained through reflection.

    Exceptions
    Type Condition
    ArgumentNullException

    If propInfo doesn't have an EntityPropertyAttribute

    ColumnDescriptor(string, string, string, string, ColumnType, Type)

    Creates a new description of a property

    Declaration
    public ColumnDescriptor(string columnName, string propertyName, string userFriendlyName, string description, ColumnType definition, Type type)
    Parameters
    Type Name Description
    string columnName

    The column name this will have to represent the property in the database. This is normally the same as the property name itself.

    string propertyName

    The name of the actual property against the entity

    string userFriendlyName

    A user friendly label for the property. If this is not set the label is the property name parsed through Wordify(string) and with any trailing ID removed

    string description

    A description of the property itself. Used by default as a tooltip for the value within the application.

    ColumnType definition

    The sql definition of the property representing how it will be stored in the database

    Type type

    The actual .net type of this property

    Fields

    LabelPropertyAppender

    Holds the name appended to a property if it also has a label. This is always the value _Label

    For instance for properties that hold ids to other items the system will also generate a property XXX_ID_Label for the XXX_ID property

    Declaration
    public const string LabelPropertyAppender = "_Label"
    Field Value
    Type Description
    string

    LabelSilentPropertyAppender

    Holds the name appended to a property if it also has a label and needs to be set silently without raising an IPropertyCHanged event. This is always the value _Label_Silent

    For instance for properties that hold ids that can be to any other entity instead of a particular one, the system will also generate a property XXX_ID_Label_Silent for the XXX_ID property

    This is used because the system can not load the labels and so has to do so separately, and needs to set them without marking anything as having changed against the entity
    Declaration
    public const string LabelSilentPropertyAppender = "_Label_Silent"
    Field Value
    Type Description
    string

    Properties

    AutoIncStart

    If set this indicates this property is an autoincrement property that the system should auto-increment on every new entity.

    The value indicates the number the auto-increment amount should initially start from if there are no existing entities, otherwise they always increment

    Set from EntityAutoIncrementColumnAttribute
    Declaration
    public long? AutoIncStart { get; set; }
    Property Value
    Type Description
    long?

    ColumnName

    Holds the actual name of the column that stores this property value in the sql database

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

    Definition

    Holds the SQL Definition of this property

    Declaration
    public ColumnType Definition { get; set; }
    Property Value
    Type Description
    ColumnType

    Description

    Holds a user friendly description of this property, often used as a tooltip in the UI to explain the value

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

    ExtendedTypeName

    Holds the actual name of the extended type

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

    Formula

    The custom formula to apply for the value of this property when evaluating this object

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

    HasLabelProperty

    Indicates this property also has a label property which happens if this property holds the id of a relationship to another entity that is marked as having a default label that can be used in this property

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

    IsDate

    Indicates this property is only using the date component of a datetime or datetimeoffset

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

    IsDateTime

    Indicates this property is using the full value of a datetime or datetimeoffset

    Declaration
    public bool IsDateTime { get; }
    Property Value
    Type Description
    bool

    IsEntityLink

    Indicates this property is a guid that holds a link to the unique global ids of entity types themselves.

    This is often used in conjunction with a property that holds the id to an item (using EntityLinkToAnyParentRelationshipAttribute) where this property holds the type of entity the other holds the id for

    Set from IsEntityTypeLink
    Declaration
    public bool IsEntityLink { get; set; }
    Property Value
    Type Description
    bool

    IsInherited

    Indicates if this property is part of the entity, or is inherited from a base entity

    Base entities are defined as inheriting a common interface marked with IsBaseInterfaceAttribute attribute, and they them selves inherits IBaseObject

    If this entity is an inheriting entity then it also inherits the common interface marked with IsBaseInterfaceAttribute and also inherit IInheritingObject
    Declaration
    public bool IsInherited { get; set; }
    Property Value
    Type Description
    bool

    IsPartOfExtendedType

    Indicates this column comes from an extended type

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

    IsPartOfKey

    Indicates if this column is part of the unique key for this entity. An entity can have more than one column as part of the key.

    The key is indicated with the EntityKeyPropertyAttribute attribute

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

    IsPivot

    Indicates this property is part of the properties definied in the pivot EntityHasPivotAttribute attribute

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

    LabelPropertyName

    Holds the name of the associated property that holds the label for the value of this property.

    Typically used if this property is an id value for another entity

    This is usually always this PropertyName + LabelPropertyAppender
    Declaration
    public string LabelPropertyName { get; set; }
    Property Value
    Type Description
    string

    Mandatory

    Indicates this column must have a value

    This is only enforced through the column be nullable or not. If you do not want it to be blank, or 0, etc you can use RequiredNoDefaultIDValidationAttribute

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

    OldColumnNames

    Holds a list of column names that were previously used to store the property value

    Declaration
    public string[] OldColumnNames { get; set; }
    Property Value
    Type Description
    string[]

    ParentPropertyName

    For nested properties only. Be careful when setting this. This requires a property to be a complex object with nested properties. In the example: MyObject.ParentProperty.NestedProperty, this property refers to "ParentProperty", and PropertyName refers to "NestedProperty"

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

    PropertyEnumType

    If the type of this property is an enum this holds the type of the enum itself

    Declaration
    public Type PropertyEnumType { get; set; }
    Property Value
    Type Description
    Type

    PropertyName

    Holds the actual name of the property on the entity class/interface

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

    PropertySQLMaxLength

    The max length for the sql type for this column from the Definition

    Declaration
    public int? PropertySQLMaxLength { get; }
    Property Value
    Type Description
    int?

    PropertySQLNullable

    The nullability of the sql type for this column from the Definition

    Declaration
    public bool PropertySQLNullable { get; }
    Property Value
    Type Description
    bool

    PropertySQLPrecision

    The precision for the sql type for this column from the Definition

    Declaration
    public int? PropertySQLPrecision { get; }
    Property Value
    Type Description
    int?

    PropertySQLScale

    The scale for the sql type for this column from the Definition

    Declaration
    public int? PropertySQLScale { get; }
    Property Value
    Type Description
    int?

    PropertySQLType

    The sql type for this column from the Definition

    Declaration
    public SQLType PropertySQLType { get; }
    Property Value
    Type Description
    SQLType

    PropertyType

    Holds the .net framework type of this property

    Declaration
    public Type PropertyType { get; set; }
    Property Value
    Type Description
    Type

    PropertyTypeName

    The name of the type of property this column holds

    Declaration
    public string PropertyTypeName { get; }
    Property Value
    Type Description
    string

    SequenceStart

    Indicates this property holds a sequence that indicates this entities sequence within a set of other entities of the same type

    The system automatically handles allowing users to move this item up/down among the set from the UI

    The value indicates the initial start value for a sequence with no other entities other than this existing one

    Set from EntitySequenceAttribute

    Declaration
    public short? SequenceStart { get; set; }
    Property Value
    Type Description
    short?

    TrackChanges

    Indicates the system will track the otiginal value of this property before it is changed

    This only happens for properties marked with DBTrackChangesAttribute and when working from a service or directly connected to the database.

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

    UseForReplicatingDescriptorType

    Indicates this property should be the one used to determine the type of entity when replicating this entity for every other entity in the system.

    Can be set from UseForReplicatingDescriptorType

    i.e. The permissions table is created for every entity in the system
    Declaration
    public bool UseForReplicatingDescriptorType { get; set; }
    Property Value
    Type Description
    bool

    UserFriendlyName

    Holds the user friendly name of the property.

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

    Methods

    Clone()

    Creates a new instance of this class (of type ColumnDescriptor) with all the same property values as this instance

    Declaration
    public ColumnDescriptor Clone()
    Returns
    Type Description
    ColumnDescriptor

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

    CopyFromSource(ColumnDescriptor)

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

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

    The source object to copy all values from.

    CopyFromSource(object)

    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(ColumnDescriptor)

    Declaration
    public bool Equals(ColumnDescriptor other)
    Parameters
    Type Name Description
    ColumnDescriptor other
    Returns
    Type Description
    bool

    Equals(object)

    Indicates this entity is equal to the other if both property names match

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

    The item to compare equality to this entity with

    Returns
    Type Description
    bool

    True if both property names match

    Overrides
    object.Equals(object)

    GetEntityLinkColumn(EntityDescriptor)

    If this is an IsAnyLink(EntityDescriptor) column this returns the other column that is an IsEntityLink for it

    This isn't explicitly specified in the interface attributes (for now) so is determined by naming convention only

    i.e. EntityID would find EntityTypeID as the link
    Declaration
    public ColumnDescriptor GetEntityLinkColumn(EntityDescriptor descriptor)
    Parameters
    Type Name Description
    EntityDescriptor descriptor
    Returns
    Type Description
    ColumnDescriptor

    GetHashCode()

    Declaration
    public override int GetHashCode()
    Returns
    Type Description
    int
    Overrides
    object.GetHashCode()

    IsAnyLink(EntityDescriptor)

    Indicates this column is an ID column that can refer to any item in the system, will have an associated IsEntityLink column for the type the id holds

    Declaration
    public bool IsAnyLink(EntityDescriptor descriptor)
    Parameters
    Type Name Description
    EntityDescriptor descriptor
    Returns
    Type Description
    bool

    ToString()

    Declaration
    public override string ToString()
    Returns
    Type Description
    string
    Overrides
    object.ToString()

    Implements

    IEquatable<T>
    ICloneable<T>
    ICloneable

    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.