Innovt Platform
Search Results for

    Show / Hide Table of Contents

    Class IocLocator

    Provides a locator for resolving services and managing dependency injection containers.

    Inheritance
    object
    IocLocator
    Inherited Members
    object.Equals(object)
    object.Equals(object, object)
    object.GetHashCode()
    object.GetType()
    object.MemberwiseClone()
    object.ReferenceEquals(object, object)
    object.ToString()
    Namespace: Innovt.Core.CrossCutting.Ioc
    Assembly: Innovt.Core.dll
    Syntax
    public static class IocLocator
    Remarks

    This static class acts as a locator for resolving services and managing dependency injection containers. It provides methods for initializing the container, resolving services, adding modules, releasing resources, creating service scopes, and checking container configuration.

    Methods

    | Edit this page View Source

    AddModule(IocModule)

    Adds an IocModule to the container.

    Declaration
    public static void AddModule(IocModule module)
    Parameters
    Type Name Description
    IocModule module

    The IocModule to be added to the container.

    Exceptions
    Type Condition
    ArgumentNullException

    Thrown if module is null.

    | Edit this page View Source

    AddModuleFromAssembly(Assembly)

    Adds modules from the specified assembly to the container.

    Declaration
    public static void AddModuleFromAssembly(Assembly assembly)
    Parameters
    Type Name Description
    Assembly assembly

    The assembly containing modules to be added.

    Exceptions
    Type Condition
    ArgumentNullException

    Thrown if assembly is null.

    | Edit this page View Source

    CheckConfiguration()

    Checks the configuration of the container.

    Declaration
    public static void CheckConfiguration()
    | Edit this page View Source

    CreateScope()

    Creates and returns a new service scope.

    Declaration
    public static IServiceScope CreateScope()
    Returns
    Type Description
    IServiceScope

    An IServiceScope representing the new service scope.

    | Edit this page View Source

    Initialize(IContainer)

    Initializes the locator with the specified main dependency injection container.

    Declaration
    public static void Initialize(IContainer mainContainer)
    Parameters
    Type Name Description
    IContainer mainContainer

    The main IContainer to be used for service resolution.

    Exceptions
    Type Condition
    ArgumentNullException

    Thrown if mainContainer is null.

    | Edit this page View Source

    Release(object)

    Releases the specified object and frees associated resources.

    Declaration
    public static void Release(object obj)
    Parameters
    Type Name Description
    object obj

    The object to release.

    | Edit this page View Source

    Resolve(Type)

    Resolves a service of the specified type.

    Declaration
    public static object Resolve(Type type)
    Parameters
    Type Name Description
    Type type

    The Type of the service to resolve.

    Returns
    Type Description
    object

    The resolved service object.

    | Edit this page View Source

    Resolve<TService>()

    Resolves a service of type TService.

    Declaration
    public static TService Resolve<TService>()
    Returns
    Type Description
    TService

    The resolved service object.

    Type Parameters
    Name Description
    TService

    The type of service to resolve.

    | Edit this page View Source

    Resolve<TService>(string)

    Resolves a named instance of a service of type TService.

    Declaration
    public static TService Resolve<TService>(string intanceKey)
    Parameters
    Type Name Description
    string intanceKey

    The key identifying the named instance to resolve.

    Returns
    Type Description
    TService

    The resolved service object.

    Type Parameters
    Name Description
    TService

    The type of service to resolve.

    | Edit this page View Source

    Resolve<TService>(Type)

    Resolves a service of type TService with the specified type.

    Declaration
    public static TService Resolve<TService>(Type type)
    Parameters
    Type Name Description
    Type type

    The Type of the service implementation to resolve.

    Returns
    Type Description
    TService

    The resolved service object.

    Type Parameters
    Name Description
    TService

    The type of service to resolve.

    • Edit this page
    • View Source
    In this article
    Back to top Generated by DocFX