Search Results for

    Show / Hide Table of Contents

    Interface IEntityCreator

    A helper class for working with new entities in the LemonEdge system

    This ensures all configured processes, settings and workflow are applied to all new items when they are created either by a user or the system itself

    Namespace: LemonEdge.API.Entities
    Assembly: LemonEdge.API.dll
    Syntax
    public interface IEntityCreator

    Methods

    CanCreate(EntityDescriptor, UserInfo, IReadOnlyCache)

    Returns true if the specified user has permissions to create the specified type of entity

    Declaration
    Task<bool> CanCreate(EntityDescriptor forEntity, UserInfo userInfo, IReadOnlyCache cache)
    Parameters
    Type Name Description
    EntityDescriptor forEntity

    The type of entity to check if the user has permissions to create

    UserInfo userInfo

    The currently logged in user

    IReadOnlyCache cache

    A local cache

    Returns
    Type Description
    Task<bool>

    True if the specified user has permissions to create the specified type of entity

    CreateNewItem(Type, UserInfo, IReadOnlyCache, IEntityUpdater, bool, Action<IBaseEntity>?)

    Creates a new instance of the specified entity ensuring all custom values, watchers and other processes are run against it where configured

    Declaration
    Task<IBaseEntity> CreateNewItem(Type type, UserInfo userInfo, IReadOnlyCache cache, IEntityUpdater updater, bool logChange = true, Action<IBaseEntity>? onCreated = null)
    Parameters
    Type Name Description
    Type type

    The type of entity to create

    UserInfo userInfo

    The currently logged in user

    IReadOnlyCache cache

    A local cache

    IEntityUpdater updater

    The context this item should be created in. By default, the system will log the item as new, as well as any other new items/changes that occur due to this item being created (such as the creation of automatic watchers). If this is null then it can not fetch anything and so will not run any custom processes.

    bool logChange

    Whether this object should be logged with the supplied updater. The default is true.

    Action<IBaseEntity> onCreated

    An optional callback to call as soon as the object is created.

    Returns
    Type Description
    Task<IBaseEntity>

    A new instance of the specified entity ensuring all custom values, watchers and other processes are run against it where configured

    CreateNewItem<T>(UserInfo, IReadOnlyCache, IEntityUpdater, bool, Action<IBaseEntity>?)

    A generic implementation of CreateNewItem(Type, UserInfo, IReadOnlyCache, IEntityUpdater, bool, Action<IBaseEntity>?)

    Declaration
    Task<T> CreateNewItem<T>(UserInfo userInfo, IReadOnlyCache cache, IEntityUpdater updater, bool logChange = true, Action<IBaseEntity>? onCreated = null) where T : IBaseEntity
    Parameters
    Type Name Description
    UserInfo userInfo
    IReadOnlyCache cache
    IEntityUpdater updater
    bool logChange
    Action<IBaseEntity> onCreated
    Returns
    Type Description
    Task<T>
    Type Parameters
    Name Description
    T

    GetCloneContext(UserInfo, IReadOnlyCache, IEntityUpdater)

    Returns a new clone context for use when cloning entities in the system

    Declaration
    BaseEntityCloneContext GetCloneContext(UserInfo user, IReadOnlyCache cache, IEntityUpdater updater)
    Parameters
    Type Name Description
    UserInfo user

    The currently logged on user to add to the context

    IReadOnlyCache cache

    A local cache

    IEntityUpdater updater

    The current context the item is to be cloned with

    Returns
    Type Description
    BaseEntityCloneContext

    A new clone context for use when cloning entities in the system

    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.