Search Results for

    Show / Hide Table of Contents

    Class AddInLoaderHelper

    This class is responsible for loading any AddIns into the current domain, along with any custom designed items through our Auto-Code Designers.

    Any classes can register an interest with this loader to be notified when new libraries are loaded

    When Addins and custom code have been loaded then all GetDescriptors() and related items have been fully loaded and can be accessed

    Inheritance
    System.Object
    AddInLoaderHelper
    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.API
    Assembly: API.dll
    Syntax
    public sealed class AddInLoaderHelper

    Properties

    PreventLoadingOfMissingEntities

    The system dynamically creates entity classes for interfaces that are missing their implementations

    This prevents the system from doing that, mainly for the AutoCodeGenerator tool which will create them all anyway

    Declaration
    public static bool PreventLoadingOfMissingEntities { get; set; }
    Property Value
    Type Description
    System.Boolean

    Type

    The type of enviroment this loader is running in - either a specific client type, or back end service core code only

    Declaration
    public static FrameworkType Type { get; set; }
    Property Value
    Type Description
    FrameworkType

    Methods

    AddListenerForAddinsLoaded(Action)

    Indicates addins have changed and changes have been loaded into the add in descriptor collections

    Declaration
    public static void AddListenerForAddinsLoaded(Action listener)
    Parameters
    Type Name Description
    System.Action listener

    The method to call when all addins have finished being loaded into the system

    AddListenerForAddinsLoaded(Func<Task>)

    Indicates addins have changed and changes have been loaded into the add in descriptor collections

    Declaration
    public static void AddListenerForAddinsLoaded(Func<Task> listener)
    Parameters
    Type Name Description
    System.Func<System.Threading.Tasks.Task> listener

    The method to call when all addins have finished being loaded into the system

    AddListenerForConfigItemsChanged(ConfigChangeType, Func<String, Task>)

    Add a listener that is called when configuration within the application is changed and committed by the user

    This can be done through updating/creating an AddIn or changing anything using our designers

    The system uses this internally to reload all addins dynamically when the user changes them

    Declaration
    public static void AddListenerForConfigItemsChanged(ConfigChangeType type, Func<string, Task> listener)
    Parameters
    Type Name Description
    ConfigChangeType type

    The type of change to be notified of

    System.Func<System.String, System.Threading.Tasks.Task> listener

    The method to call when changes of the specified type have been made in the system

    GetAddInOnlyLoadedAssemblies(String)

    Returns a list of all currently loaded dynamic assemblies from addins for forDBConnection

    Declaration
    public static IEnumerable<(IAddIn, Assembly)> GetAddInOnlyLoadedAssemblies(string forDBConnection = null)
    Parameters
    Type Name Description
    System.String forDBConnection

    Indicates the database alias these assemblies are associated with

    Returns
    Type Description
    System.Collections.Generic.IEnumerable<System.ValueTuple<IAddIn, System.Reflection.Assembly>>

    A list of all currently loaded dynamic assemblies from addins for the forDBConnection

    GetAllCustomLoadedAssemblies(String)

    Returns a list of all currently loaded dynamic assemblies from addins and custom objects from the specified forDBConnection

    Declaration
    public static IEnumerable<Assembly> GetAllCustomLoadedAssemblies(string forDBConnection = null)
    Parameters
    Type Name Description
    System.String forDBConnection

    Indicates the database alias these assemblies are associated with

    Returns
    Type Description
    System.Collections.Generic.IEnumerable<System.Reflection.Assembly>

    A list of all currently loaded dynamic assemblies from addins and custom objects from the specified forDBConnection

    GetCustomOnlyLoadedAssemblies(String)

    Returns a list of all currently loaded dynamic assemblies from custom entities for forDBConnection

    Declaration
    public static IEnumerable<Assembly> GetCustomOnlyLoadedAssemblies(string forDBConnection = null)
    Parameters
    Type Name Description
    System.String forDBConnection

    Indicates the database alias these assemblies are associated with

    Returns
    Type Description
    System.Collections.Generic.IEnumerable<System.Reflection.Assembly>

    A list of all currently loaded dynamic assemblies from custom entities for the forDBConnection

    Init(String, IEntityRetriever)

    Loads all the addins for the current Type from the provided context and alias.

    Can be used when initialliy connecting to the system after logging in to dyanmically load all modules instead of using

    Declaration
    public static Task Init(string alias, IEntityRetriever context)
    Parameters
    Type Name Description
    System.String alias

    The alias for the currently connected service

    IEntityRetriever context

    A context for loading all the addins and modules from

    Returns
    Type Description
    System.Threading.Tasks.Task

    A task indicating the completion of the operation

    LoadAddins(Func<Task<IEnumerable<(IAddInModule Module, IAddIn AddIn)>>>, String)

    Loads all the specified addin modules and associated addins and dynamically creates and loads those dlls form theis image (AddInData)

    Declaration
    public static Task<IEnumerable<(IAddIn AddIn, Assembly LoadedAssembly)>> LoadAddins(Func<Task<IEnumerable<(IAddInModule Module, IAddIn AddIn)>>> getAddIns, string forDBConnection)
    Parameters
    Type Name Description
    System.Func<System.Threading.Tasks.Task<System.Collections.Generic.IEnumerable<System.ValueTuple<IAddInModule, IAddIn>>>> getAddIns

    A function that returns a task that will provide an enumeration of modules and their associated addins to be loaded dynamically

    System.String forDBConnection

    Indicates the database alias these addins are associated with

    Returns
    Type Description
    System.Threading.Tasks.Task<System.Collections.Generic.IEnumerable<System.ValueTuple<IAddIn, System.Reflection.Assembly>>>

    A task indicating the completion of the operation

    LoadCustomObjects(Func<Task<Dictionary<ICustomObject, IEnumerable<ICustomObjectProperty>>>>, String, Boolean)

    Loads all the specified custom objects, creates their equivelant code add dynamic loads those dlls as AddIns for the system to use

    Not all custom objects are loaded, as some are disabled (LoadDynamically) as users may be loaded the provided code through their own dll

    You should not need to use this, the system will automatically call it when any changes that affects the custom objects are successfully committed

    Declaration
    public static Task<(byte[] Data, Assembly Assembly)> LoadCustomObjects(Func<Task<Dictionary<ICustomObject, IEnumerable<ICustomObjectProperty>>>> getCustomObjects, string forDBConnection, bool throwErrors)
    Parameters
    Type Name Description
    System.Func<System.Threading.Tasks.Task<System.Collections.Generic.Dictionary<ICustomObject, System.Collections.Generic.IEnumerable<ICustomObjectProperty>>>> getCustomObjects

    A function that returns a task that will provide a dictionary of all custom objects and associated properties to be laoded dynamically into the system

    System.String forDBConnection

    Indicates the database alias these custom objects are associated with

    System.Boolean throwErrors

    If false the system will just log errors, otherwise it will also throw them

    Returns
    Type Description
    System.Threading.Tasks.Task<System.ValueTuple<System.Byte[], System.Reflection.Assembly>>

    A task indicating the completion of the operation

    LoadStandardExecutableReferences()

    Ensures all loaded dlls are added as executable references to the main CodeBuilder to ensure all scripts dynamically work and can reference dlls

    Declaration
    public static Task LoadStandardExecutableReferences()
    Returns
    Type Description
    System.Threading.Tasks.Task

    Task indicating completion of operation

    OnConfigItemsChanged(String, ConfigChangeType)

    Indicates to the system that custom items have changed, such as addins or auto-code designed items.

    Notifies all listeners added through AddListenerForConfigItemsChanged(ConfigChangeType, Func<String, Task>)

    Declaration
    public static Task OnConfigItemsChanged(string dbAlias, ConfigChangeType type)
    Parameters
    Type Name Description
    System.String dbAlias

    The alias of the connected database that holds the changes

    ConfigChangeType type
    Returns
    Type Description
    System.Threading.Tasks.Task

    A task inidcating when all listeners have finished processing the notification

    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.