Search Results for

    Show / Hide Table of Contents

    Class EntityDescriptorFactory

    The main factory for creating and providing EntityDescriptor and ComplexTypeDescriptor for all items in the system including those defined by custom objects and addins

    This automatically reloads whenever changes to custom objects or addins are detected within the system

    Inheritance
    System.Object
    EntityDescriptorFactory
    Inherited Members
    System.Object.Equals(System.Object)
    System.Object.Equals(System.Object, System.Object)
    System.Object.GetHashCode()
    System.Object.GetType()
    System.Object.MemberwiseClone()
    System.Object.ReferenceEquals(System.Object, System.Object)
    System.Object.ToString()
    Namespace: LemonEdge.Core.Descriptors
    Assembly: API.dll
    Syntax
    public class EntityDescriptorFactory

    Methods

    Create<T>(UserInfo)

    Creates a new instance of the specified item, either from the interface or class type

    Declaration
    public static Task<T> Create<T>(UserInfo createdBy)
        where T : IBaseEntity
    Parameters
    Type Name Description
    UserInfo createdBy

    The user that is creating this new item

    Returns
    Type Description
    System.Threading.Tasks.Task<T>

    A new instance of the specified item, either from the interface or class type

    Type Parameters
    Name Description
    T

    The type of entity to create a new instance of. Can be either the interface or class type.

    GetAllDependantEntities(EntityDescriptor)

    Returns a list of all entity descriptors that are dependant on the specified entity descriptor, and in turn their child dependancys too

    Declaration
    public static IEnumerable<EntityDescriptor> GetAllDependantEntities(EntityDescriptor desc)
    Parameters
    Type Name Description
    EntityDescriptor desc

    The entity descriptor to get all child dependant entity descriptors for

    Returns
    Type Description
    System.Collections.Generic.IEnumerable<EntityDescriptor>

    A list of all entity descriptors that are dependant on the specified entity descriptor, and in turn their child dependancys too

    GetCachedDescriptors()

    Returns all descriptors that are part of the standing data cache

    Declaration
    public static IEnumerable<EntityDescriptor> GetCachedDescriptors()
    Returns
    Type Description
    System.Collections.Generic.IEnumerable<EntityDescriptor>

    All descriptors that are part of the standing data cache

    GetComplexTypeDescriptor(Object)

    Returns the ComplexTypeDescriptor for the specified instance of a complex type

    Declaration
    public static ComplexTypeDescriptor GetComplexTypeDescriptor(object forObject)
    Parameters
    Type Name Description
    System.Object forObject

    An instance of a complex type

    Returns
    Type Description
    ComplexTypeDescriptor

    The ComplexTypeDescriptor for the specified instance of a complex type

    GetComplexTypes()

    Returns a ComplexTypeDescriptor for every complex type found in the system including through custom objects and addins

    Declaration
    public static IEnumerable<ComplexTypeDescriptor> GetComplexTypes()
    Returns
    Type Description
    System.Collections.Generic.IEnumerable<ComplexTypeDescriptor>

    A ComplexTypeDescriptor for every complex type found in the system including through custom objects and addins

    GetDescriptor(IBaseEntity)

    Returns the EntityDescriptor for the specified instance of an entity

    Declaration
    public static EntityDescriptor GetDescriptor(IBaseEntity item)
    Parameters
    Type Name Description
    IBaseEntity item

    The instance of an entity to return its associated entity descriptor for

    Returns
    Type Description
    EntityDescriptor

    The EntityDescriptor for the specified instance of an entity

    GetDescriptor(Guid, Guid)

    Returns the entitydescriptor for the specified type, and specified sub type (if looking for a replicated entitydescriptor)

    Declaration
    public static EntityDescriptor GetDescriptor(Guid id, Guid forType = default(Guid))
    Parameters
    Type Name Description
    System.Guid id
    System.Guid forType

    The unique global id of an entity that is the sub type for the entity descriptor - used when looking for a replicated entity descriptor

    Returns
    Type Description
    EntityDescriptor

    GetDescriptor(String)

    Returns the entitydescriptor for the specified uniqueKey of an entitydescriptor

    Declaration
    public static EntityDescriptor GetDescriptor(string uniqueKey)
    Parameters
    Type Name Description
    System.String uniqueKey

    The UniqueKey of an entity descriptor

    Returns
    Type Description
    EntityDescriptor

    The entitydescriptor for the specified uniqueKey of an entitydescriptor

    GetDescriptor(Type, Guid)

    Returns the entitydescriptor for the specified type, and specified sub type (if looking for a replicated entitydescriptor)

    Declaration
    public static EntityDescriptor GetDescriptor(Type t, Guid forType = default(Guid))
    Parameters
    Type Name Description
    System.Type t

    The type of an entity (either its interface or class type)

    System.Guid forType

    The unique global id of an entity that is the sub type for the entity descriptor - used when looking for a replicated entity descriptor

    Returns
    Type Description
    EntityDescriptor

    GetDescriptorBeingQueried(QueryableExecuter)

    Returns the entitydescriptor for the type being queried in an QueryableExecuter

    Declaration
    public static EntityDescriptor GetDescriptorBeingQueried(QueryableExecuter queryItems)
    Parameters
    Type Name Description
    QueryableExecuter queryItems

    A query

    Returns
    Type Description
    EntityDescriptor

    The entitydescriptor for the type being queried in an QueryableExecuter

    GetDescriptors()

    Returns an EntityDescriptor for each entity within the system including those defined through custom objects and addins

    This also includes replicated entity descriptors - in other words the complete set of all entity descriptors available within the system

    Declaration
    public static IEnumerable<EntityDescriptor> GetDescriptors()
    Returns
    Type Description
    System.Collections.Generic.IEnumerable<EntityDescriptor>

    An EntityDescriptor for each entity within the system including those defined through custom objects and addins

    GetDescriptors(String)

    Returns all entitydescriptors restricted to just those for a particular database.

    This is required for task services and other processes that connect to multiple lemonedge databases at once

    Declaration
    public static IEnumerable<EntityDescriptor> GetDescriptors(string forDB)
    Parameters
    Type Name Description
    System.String forDB

    The alias for the connected database

    Returns
    Type Description
    System.Collections.Generic.IEnumerable<EntityDescriptor>

    All entitydescriptors restricted to just those for a particular database.

    GetDescriptorsInSaveOrder(IEnumerable<EntityDescriptor>)

    Returns all the specified entity descriptors in the order that they should be saved in so dependancies are correct

    Declaration
    public static IEnumerable<EntityDescriptor> GetDescriptorsInSaveOrder(IEnumerable<EntityDescriptor> descriptors)
    Parameters
    Type Name Description
    System.Collections.Generic.IEnumerable<EntityDescriptor> descriptors

    A list of entity descriptors that should be sorted into the order in which they should be saved

    Returns
    Type Description
    System.Collections.Generic.IEnumerable<EntityDescriptor>

    All the specified entity descriptors in the order that they should be saved in so dependancies are correct

    GetDirectDependantEntities(EntityDescriptor, Boolean)

    Returns a list of all entity descriptors that are directly dependant on the specified descriptor through relationships

    Declaration
    public static IEnumerable<EntityDescriptor> GetDirectDependantEntities(EntityDescriptor desc, bool includeParentToAnyRelationships)
    Parameters
    Type Name Description
    EntityDescriptor desc

    The entity descriptor to return all directly dependant entity descriptors for

    System.Boolean includeParentToAnyRelationships

    Indicates if relationships that can have any entity as a parent should be included in the results

    Returns
    Type Description
    System.Collections.Generic.IEnumerable<EntityDescriptor>

    A list of all entity descriptors that are directly dependant on the specified descriptor through relationships

    GetItemsInTypeReverseSaveOrder(IEnumerable<IBaseEntity>)

    Returns the specified set of entities in the reverse order they should be saved in

    Declaration
    public static IEnumerable<IBaseEntity> GetItemsInTypeReverseSaveOrder(IEnumerable<IBaseEntity> items)
    Parameters
    Type Name Description
    System.Collections.Generic.IEnumerable<IBaseEntity> items

    A set of entities that should be ordered according to the reverse order in which they should be saved

    Returns
    Type Description
    System.Collections.Generic.IEnumerable<IBaseEntity>

    The specified set of entities in the reverse order they should be saved in

    GetItemsInTypeSaveOrder(IEnumerable<IBaseEntity>)

    Returns the specified set of entities in the order they should be saved in

    Declaration
    public static IEnumerable<IBaseEntity> GetItemsInTypeSaveOrder(IEnumerable<IBaseEntity> items)
    Parameters
    Type Name Description
    System.Collections.Generic.IEnumerable<IBaseEntity> items

    A set of entities that should be ordered according to the order in which they should be saved

    Returns
    Type Description
    System.Collections.Generic.IEnumerable<IBaseEntity>

    The specified set of entities in the order they should be saved in

    GetKnownTypes()

    Returns all known entity tyes and enum types within all loaded entity descriptors in the system

    Used for serialization

    Declaration
    public static IEnumerable<Type> GetKnownTypes()
    Returns
    Type Description
    System.Collections.Generic.IEnumerable<System.Type>

    All known entity tyes and enum types within all loaded entity descriptors in the system

    GetTypeDistinctDescriptors()

    Returns an EntityDescriptor for each entity within the system excluding ones that have been replicated from other entity descriptors

    For example only one entitydescriptor for IPermission would be returned, and not one for each entity descriptor in the system replicated for each one with permissions

    Declaration
    public static IEnumerable<EntityDescriptor> GetTypeDistinctDescriptors()
    Returns
    Type Description
    System.Collections.Generic.IEnumerable<EntityDescriptor>

    An EntityDescriptor for each entity within the system excluding ones that have been replicated from other entity descriptors

    IsPartOfSpecificAssembly(Guid, IEnumerable<Assembly>)

    It's possible using custom objects (which dynamically create dlls) that we have the same object design (using the same typeids -> sharedkey) in two databases we can only have one entity descriptor for that typeid, so we store any other assemblies that reference the same typeid then here we can say that if specific dlls are requested we can return that typeid if it is part of our stored assemblies

    Declaration
    public static bool IsPartOfSpecificAssembly(Guid typeID, IEnumerable<Assembly> customAssemblies)
    Parameters
    Type Name Description
    System.Guid typeID

    The unique global type of an entity that needs to be checked if it is defined in the list of assemblies

    System.Collections.Generic.IEnumerable<System.Reflection.Assembly> customAssemblies

    A list of assemblies to check if the specified entity type is defined within it

    Returns
    Type Description
    System.Boolean

    True if the unique global id of the entity descriptor is defined as an entity in the specified list of assemblies

    Extension Methods

    MiscExtensions.SetIfNotEqual<T, P>(T, Expression<Func<T, P>>, P)
    ReflectionExtensions.ClearEventInvocations(Object, String)
    StringExtensions.ToCSVFormatString(Object, Type)
    SQLExtensions.ToSQLValue(Object, Boolean)
    In This Article
    Back to top © LemonTree Software Ltd. All rights reserved.