Search Results for

    Show / Hide Table of Contents

    Interface IServiceResolver

    interface used by fastendpoints for resolving services from the DI container. implement this interface and register the implementation in MS DI for customizing service resolving.

    Inherited Members
    IServiceResolverBase.CreateScope()
    IServiceResolverBase.TryResolve<TService>()
    IServiceResolverBase.TryResolve(Type)
    IServiceResolverBase.Resolve<TService>()
    IServiceResolverBase.Resolve(Type)
    Namespace: FastEndpoints
    Assembly: FastEndpoints.dll
    Syntax
    public interface IServiceResolver : IServiceResolverBase

    Methods

    CreateInstance(Type, IServiceProvider)

    create an instance of a given type (which may not be registered in the DI container). this method will be called repeatedly per request. so a cached delegate/compiled expression such as Microsoft.Extensions.DependencyInjection.ActivatorUtilities.CreateFactory(System.Type,System.Type[]) should be used for instance creation.

    Declaration
    object CreateInstance(Type type, IServiceProvider serviceProvider = null)
    Parameters
    Type Name Description
    System.Type type

    the type to create an instance of

    System.IServiceProvider serviceProvider

    optional service provider

    Returns
    Type Description
    System.Object

    CreateSingleton(Type)

    create an instance of a given type (which may not be registered in the DI container) which will be used as a singleton. a utility such as Microsoft.Extensions.DependencyInjection.ActivatorUtilities.CreateInstance(System.IServiceProvider,System.Type,System.Object[]) may be used.

    Declaration
    object CreateSingleton(Type type)
    Parameters
    Type Name Description
    System.Type type

    the type to create an instance of

    Returns
    Type Description
    System.Object
    In This Article
    Back to top Developed by Đĵ ΝιΓΞΗΛψΚ and contributors / Licensed under MIT / Website generated by DocFX