Class EntityRelationship
Holds the definition of a relationship between two entities and their associated properties
Normally defined through one of the PropRelationship inherited attributes
Inheritance
Inherited Members
Namespace: LemonEdge.Core.Descriptors
Assembly: API.dll
Syntax
public class EntityRelationship
Constructors
EntityRelationship(EntityDescriptor, EntityDescriptor, String, String, PropRelationship)
Creates a new entity relationship for the specified entities
Declaration
public EntityRelationship(EntityDescriptor source, EntityDescriptor target, string sourceColumn, string targetColumn, PropRelationship 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 |
System.String | sourceColumn | The name of the property on the source entity that holds the value to match on the target property |
System.String | targetColumn | The name of the property (typically the ID) on the target entity that holds the matching value from the source property |
PropRelationship | relationship | The associated EntityRelationship 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 |
System.String | sourceColumn | The name of the property on the source entity that holds the value to match on the target property |
System.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 |
System.String | sourceLabel | The user friendly label to refer to this relationship when viewed from the source entity |
System.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 |
---|---|
System.Boolean |
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 |
---|---|
System.Collections.Generic.IEnumerable<System.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 |
---|---|
System.Boolean |
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 |
---|---|
System.Boolean |
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 |
---|---|
System.Boolean |
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 |
---|---|
System.Boolean |
PartOfParentSetTypeModifier
Indicates this relationship holds modifications of the PartOfParentSet through the EntityLinkToAnyParentRelationshipModifier attribute on possible parent entities
Declaration
public Dictionary<EntityDescriptor, bool> PartOfParentSetTypeModifier { get; set; }
Property Value
Type | Description |
---|---|
System.Collections.Generic.Dictionary<EntityDescriptor, System.Boolean> |
PreventAutoConstraint
Indicates that this relationship should not automatically have an associated constraint created in the database table for this entity for it
Declaration
public bool PreventAutoConstraint { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
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 |
---|---|
System.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 |
---|---|
System.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 |
---|---|
System.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 |
---|---|
System.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 |
---|---|
System.String |
Methods
CanBeParentTypeForRelationship(EntityDescriptor)
Indicates if the specified entitydescriptor can be the parent for this relationship if it is an EntityLinkToAnyParentRelationship
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 |
---|---|
System.Boolean | 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 EntityLinkToAnyParentRelationship 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 |
---|---|
System.Boolean | True if given the specified target entity this source entity would be part of that parent set or not |