Search Results for

    Show / Hide Table of Contents

    Class ExtensionsRepository

    Implements an extensions repository which stores singleton instances of the extensions

    Inheritance
    object
    ExtensionsRepository
    Inherited Members
    object.GetType()
    object.ToString()
    object.Equals(object)
    object.Equals(object, object)
    object.ReferenceEquals(object, object)
    object.GetHashCode()
    Namespace: Sdl.Core.PluginFramework.Integration
    Assembly: Sdl.Core.PluginFramework.dll
    Syntax
    public sealed class ExtensionsRepository

    Properties

    Instance

    Single instance of the ExtensionsRepository

    Declaration
    public static ExtensionsRepository Instance { get; }
    Property Value
    Type Description
    ExtensionsRepository

    Methods

    AddExtension<TResult>(IExtension, ExtensionArguments, Func<IExtension, object, ExtensionArguments, object>)

    Add an extension to the repository

    Declaration
    public TResult AddExtension<TResult>(IExtension extension, ExtensionArguments arguments, Func<IExtension, object, ExtensionArguments, object> instanceCreator) where TResult : class
    Parameters
    Type Name Description
    IExtension extension

    The extension object

    ExtensionArguments arguments

    The arguments required by the instance creator for the extension instance initialization

    Func<IExtension, object, ExtensionArguments, object> instanceCreator

    A delegate passed to initialize a custom extension instance which will get the extension object, default extension instance and the extension initializer arguments

    Returns
    Type Description
    TResult

    The instance created and stored in the repository or an assignable instance already present in the repository.

    Type Parameters
    Name Description
    TResult

    The instance which is stored or was created while storing.

    FirstOrDefault(Func<ExtensionStoreItem, bool>)

    Returns the first element stored in the repository that satisfies a condition or a default value if no such element found.

    Declaration
    public ExtensionStoreItem FirstOrDefault(Func<ExtensionStoreItem, bool> predicate)
    Parameters
    Type Name Description
    Func<ExtensionStoreItem, bool> predicate

    The predicate used for the searching inside the repository.

    Returns
    Type Description
    ExtensionStoreItem

    Returns the first element stored in the repository that contains the instance reference.

    FirstOrDefault(object)

    Returns the first element stored in the repository that contains the extension instance reference.

    Declaration
    public ExtensionStoreItem FirstOrDefault(object extensionInstanceReference)
    Parameters
    Type Name Description
    object extensionInstanceReference

    The extension instance reference which is searched in the repository

    Returns
    Type Description
    ExtensionStoreItem

    Returns the first element stored in the repository that contains the instance reference.

    GetAssignableInstanceOrDefault<TResult>(IExtension)

    Returns an extension instance from the repository which can be assigned to a specified TResult type or null if none was found.

    Declaration
    public TResult GetAssignableInstanceOrDefault<TResult>(IExtension extension) where TResult : class
    Parameters
    Type Name Description
    IExtension extension

    The extension instance for which the search is done.

    Returns
    Type Description
    TResult

    Returns the extension instance assignable to TResult.

    Type Parameters
    Name Description
    TResult

    The assignable instance type which is required from the extension store.

    GetAssignableInstanceOrDefault<TResult>(Type, Type)

    Returns an extension instance from the repository which can be assigned to a specified TResult type or null if none was found.

    Declaration
    public TResult GetAssignableInstanceOrDefault<TResult>(Type extensionAttributeType, Type extensionType) where TResult : class
    Parameters
    Type Name Description
    Type extensionAttributeType

    The type for an attribute decorating the extension for which the search is done.

    Type extensionType

    The extension type for which the search is done.

    Returns
    Type Description
    TResult

    Returns the extension instance assignable to TResult.

    Type Parameters
    Name Description
    TResult

    The assignable instance type which is required from the extension store.

    GetAssignableInstanceOrDefault<TAttribute, TExtensionType, TResult>()

    Returns an extension instance from the repository which can be assigned to a specified TResult type or null if none was found

    Declaration
    public TResult GetAssignableInstanceOrDefault<TAttribute, TExtensionType, TResult>() where TAttribute : ExtensionAttribute where TResult : class
    Returns
    Type Description
    TResult

    Returns the extension instance assignable to TResult.

    Type Parameters
    Name Description
    TAttribute

    The extension attribute type for which the search is done.

    TExtensionType

    The extension type for which the search is done.

    TResult

    The assignable instance type which is required from the extension store.

    In this article
    • Properties
      • Instance
    • Methods
      • AddExtension<TResult>(IExtension, ExtensionArguments, Func<IExtension, object, ExtensionArguments, object>)
      • FirstOrDefault(Func<ExtensionStoreItem, bool>)
      • FirstOrDefault(object)
      • GetAssignableInstanceOrDefault<TResult>(IExtension)
      • GetAssignableInstanceOrDefault<TResult>(Type, Type)
      • GetAssignableInstanceOrDefault<TAttribute, TExtensionType, TResult>()
    Back to top Generated by DocFX