Search Results for

    Show / Hide Table of Contents

    Class EntityRelationship

    Holds the definition of a relationship between two entities and their associated properties

    Normally defined through one of the PropRelationshipAttribute inherited attributes

    Inheritance
    object
    EntityRelationship
    Inherited Members
    object.GetType()
    object.MemberwiseClone()
    object.Equals(object)
    object.Equals(object, object)
    object.ReferenceEquals(object, object)
    object.GetHashCode()
    Namespace: LemonEdge.API.Descriptors
    Assembly: LemonEdge.API.dll
    Syntax
    public class EntityRelationship

    Constructors

    EntityRelationship(EntityDescriptor, EntityDescriptor, string, string, PropRelationshipAttribute)

    Creates a new entity relationship for the specified entities

    Declaration
    public EntityRelationship(EntityDescriptor source, EntityDescriptor target, string sourceColumn, string targetColumn, PropRelationshipAttribute relationship)
    Parameters
    Type Name Description
    EntityDescriptor source

    The source entity this relationship comes from

    EntityDescriptor target

    The target entity of this relationship that it points to

    string sourceColumn

    The name of the property on the source entity that holds the value to match on the target property

    string targetColumn

    The name of the property (typically the ID) on the target entity that holds the matching value from the source property

    PropRelationshipAttribute relationship

    The associated EntityRelationshipAttribute attribute.

    EntityRelationship(EntityDescriptor, EntityDescriptor, string, string, SingleJoinType, string, string)

    Creates a new entity relationship for the specified entities

    Declaration
    public EntityRelationship(EntityDescriptor source, EntityDescriptor target, string sourceColumn, string targetColumn, SingleJoinType type, string sourceLabel, string targetLabel)
    Parameters
    Type Name Description
    EntityDescriptor source

    The source entity this relationship comes from

    EntityDescriptor target

    The target entity of this relationship that it points to

    string sourceColumn

    The name of the property on the source entity that holds the value to match on the target property

    string targetColumn

    The name of the property (typically the ID) on the target entity that holds the matching value from the source property

    SingleJoinType type

    Indicates the type of relationship. ZeroToOne essentially indicates that the sourceColumn must be nullable, where as One indicates the relationship must have a value

    string sourceLabel

    The user friendly label to refer to this relationship when viewed from the source entity

    string targetLabel

    The user friendly label to refer to this relationship when viewed from the target entity

    Properties

    DeleteWithRelationship

    Indicates when the target entity is deleted, it should cascade downwards through this relationship and also delete this source entity as well automatically

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

    ExcludeSourceTypes

    If this is a relationship for an any parent type, this holds the types that can not be parents. i.e. transactions can be children of any types, apart from transactionallocations, glpostings, glpostingsallocated

    Declaration
    public IEnumerable<Type> ExcludeSourceTypes { get; set; }
    Property Value
    Type Description
    IEnumerable<Type>

    InheritPermissions

    Indicates this relationship is what the source entity should use to inherit permissions from

    The permissions of the target entity are the permissions this source entity should use.

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

    IsTypeExtender

    Indicates this relationship points to the ID column of the target type, and "extends" the properties of that type. In other words from a UI perspective this object can be displayed against an instance of the target type

    Set from IsTypeExtender

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

    JoinType

    Indicates the type of relationship. ZeroToOne essentially indicates that the SourceColumn must be nullable, where as One indicates the relationship must have a value

    Declaration
    public SingleJoinType JoinType { get; set; }
    Property Value
    Type Description
    SingleJoinType

    LinkToItemInSet

    Indicates the item this point is its own set, but that item should be included in part of any import/export and canvas promotion

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

    OnlyWithLabels

    If this is a relationship for an any parent type this indicates this links to entity descriptors only where they have a label - i.e. are a root entity descriptor of some type, child items wouldn't be included

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

    PartOfParentSet

    Indicates this item is part of a parent set. should be included in imports/exports, and canvas promotions of parent items

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

    PartOfParentSetTypeModifier

    Indicates this relationship holds modifications of the PartOfParentSet through the EntityLinkToAnyParentRelationshipModifierAttribute attribute on possible parent entities

    Declaration
    public Dictionary<EntityDescriptor, bool> PartOfParentSetTypeModifier { get; set; }
    Property Value
    Type Description
    Dictionary<EntityDescriptor, bool>

    PreventAutoConstraint

    Indicates that this relationship should not automatically have an associated constraint created in the database table for this entity for it

    See PreventAutoConstraint

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

    Source

    The source entity this relationship comes from

    Declaration
    public EntityDescriptor Source { get; set; }
    Property Value
    Type Description
    EntityDescriptor

    SourceColumn

    The name of the property on the source entity that holds the value to match on the target property

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

    SourceLabel

    The user friendly label to refer to this relationship when viewed from the source entity

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

    SourceTypeColumnName

    If this is a relationship for an any parent type, this holds the column name that holds the type id the link is to.

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

    Target

    The target entity of this relationship that it points to

    Declaration
    public EntityDescriptor Target { get; set; }
    Property Value
    Type Description
    EntityDescriptor

    TargetColumn

    The name of the property (typically the ID) on the target entity that holds the matching value from the source property

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

    TargetLabel

    The user friendly label to refer to this relationship when viewed from the target entity

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

    Methods

    CanBeParentTypeForRelationship(EntityDescriptor)

    Indicates if the specified entitydescriptor can be the parent for this relationship if it is an EntityLinkToAnyParentRelationshipAttribute

    This takes account of ensuring the specified entity is not part of any of the ExcludeSourceTypes

    Declaration
    public bool CanBeParentTypeForRelationship(EntityDescriptor desc)
    Parameters
    Type Name Description
    EntityDescriptor desc

    The entity to see if it can be a valid parent of this AnyParent relationship

    Returns
    Type Description
    bool

    True if the specified entity is a valid entity for being the parent/target of this relationship

    CanBePartOfParentSet(EntityDescriptor)

    Indicates if this specified entity is the target for this EntityLinkToAnyParentRelationshipAttribute then is the source entity part of that parent set or not

    This takes account of any PartOfParentSetTypeModifier before using the default PartOfParentSet

    Declaration
    public bool CanBePartOfParentSet(EntityDescriptor desc)
    Parameters
    Type Name Description
    EntityDescriptor desc

    The entity to see if this source entity is part of the parent set or not

    Returns
    Type Description
    bool

    True if given the specified target entity this source entity would be part of that parent set or not

    ToString()

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

    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.