Interface IEntityDescriptorTemplate
Namespace: LemonEdge.API.Descriptors
Assembly: LemonEdge.API.dll
Syntax
public interface IEntityDescriptorTemplate
Methods
GetImportDefinitions(EntityDescriptor, IReadOnlyCache)
Returns a collection of EntityImportColDefinition for this entity descriptor.
These determine the properties that can be exported/imported by the system
If the entity descriptor has a EntityDescriptorTemplateExtender associated with it that is used to get the list of column definitionsOtherwise the system automatically generates them from the properties on the entity descriptor itself. It also uses the system ImportActionPropertyName and EntityImportColDefinition columns, and populates external data source and pivot columns automatically too
Declaration
Task<IEnumerable<EntityImportColDefinition>> GetImportDefinitions(EntityDescriptor desc, IReadOnlyCache cache)
Parameters
Type | Name | Description |
---|---|---|
EntityDescriptor | desc | The entity descriptor to return a collection of valid EntityImportColDefinitions for |
IReadOnlyCache | cache | The local cache |
Returns
Type | Description |
---|---|
Task<IEnumerable<EntityImportColDefinition>> | A collection of EntityDescriptorTemplate for this entity descriptor. |
GetItem(Type, Guid?, IEnumerable<(object Value, EntityImportColDefinition Definition)>, IEntityRetriever, IReadOnlyCache, bool)
Returns the item being linked to from an import set of key values referring to it
Declaration
Task<IBaseEntity> GetItem(Type itemType, Guid? subItemID, IEnumerable<(object Value, EntityImportColDefinition Definition)> keyIDs, IEntityRetriever retriever, IReadOnlyCache cache, bool addToCache)
Parameters
Type | Name | Description |
---|---|---|
Type | itemType | The globally unique id of the type of the entity to load |
Guid? | subItemID | Any sub id of the entity type if its a replicated entity descriptor |
IEnumerable<(object Value, EntityImportColDefinition Definition)> | keyIDs | A list of the key values needed to load the item being referred to through an import relationship |
IEntityRetriever | retriever | The current conext for loading the item |
IReadOnlyCache | cache | A local cache |
bool | addToCache | Specifies the item should be added to the |
Returns
Type | Description |
---|---|
Task<IBaseEntity> | The item being linked to from an import set of key values referring to it |
GetKeyValues(string, EntityDescriptor, IEntityRetriever, IReadOnlyCache)
Given a string key of the format:
Key1=Val1;;Key2=Val2;;Rel1_Key1=Val3;;Rel1_Key2
This function for a given entity descriptor returns all the values (parsed according to their type), and associated entity import column definitions for each key in the stringThis is required for key columns that can refer to any parent relationship as they have their multiple key values stored as above
Declaration
Task<IEnumerable<(object Value, EntityImportColDefinition Col)>> GetKeyValues(string stringKey, EntityDescriptor desc, IEntityRetriever retriever, IReadOnlyCache cache)
Parameters
Type | Name | Description |
---|---|---|
string | stringKey | A string value of multiple key names and values, in the format Key1=Val1;;Key2=Val2;;Rel1_Key1=Val3;;Rel1_Key2 |
EntityDescriptor | desc | The entity descriptor for which we are loading the keys for |
IEntityRetriever | retriever | The current conext for loading possible values |
IReadOnlyCache | cache | A local cache |
Returns
Type | Description |
---|---|
Task<IEnumerable<(object Value, EntityImportColDefinition Col)>> | A list of entity column definitions and their associated parsed values for all keys in the string |
TryGetTemplateExtender(EntityDescriptor, out EntityDescriptorTemplateExtender)
If this entitytype has a EntityDescriptorTemplateExtender defined for it, this will be returned, otherwise no extender will be returned
Declaration
bool TryGetTemplateExtender(EntityDescriptor desc, out EntityDescriptorTemplateExtender extender)
Parameters
Type | Name | Description |
---|---|---|
EntityDescriptor | desc | The entitydescriptor to see if it has an extender defined for it |
EntityDescriptorTemplateExtender | extender | The out return value of the found extender |
Returns
Type | Description |
---|---|
bool | True if the entity descriptor has a defined template extender, false otherwise |