Search Results for

    Show / Hide Table of Contents

    Class ServiceScopeExtensions

    Inheritance
    object
    ServiceScopeExtensions
    Inherited Members
    object.Equals(object)
    object.Equals(object, object)
    object.GetHashCode()
    object.GetType()
    object.MemberwiseClone()
    object.ReferenceEquals(object, object)
    object.ToString()
    Namespace: FastEndpoints
    Assembly: FastEndpoints.dll
    Syntax
    public static class ServiceScopeExtensions

    Methods

    Resolve(IServiceScope, Type)

    resolve an instance for the given type from the dependency injection container. will throw if unresolvable.

    Declaration
    public static object Resolve(this IServiceScope scope, Type typeOfService)
    Parameters
    Type Name Description
    IServiceScope scope
    Type typeOfService

    the type of the service to resolve

    Returns
    Type Description
    object
    Exceptions
    Type Condition
    InvalidOperationException

    Thrown if requested service cannot be resolved

    Resolve(IServiceScope, Type, string)

    resolve an instance for the given type from the dependency injection container. will throw if unresolvable.

    Declaration
    public static object Resolve(this IServiceScope scope, Type typeOfService, string keyName)
    Parameters
    Type Name Description
    IServiceScope scope
    Type typeOfService

    the type of the service to resolve

    string keyName
    Returns
    Type Description
    object
    Exceptions
    Type Condition
    InvalidOperationException

    Thrown if requested service cannot be resolved

    Resolve<TService>(IServiceScope)

    resolve an instance for the given type from the dependency injection container. will throw if unresolvable.

    Declaration
    public static TService Resolve<TService>(this IServiceScope scope) where TService : class
    Parameters
    Type Name Description
    IServiceScope scope
    Returns
    Type Description
    TService
    Type Parameters
    Name Description
    TService

    the type of the service to resolve

    Exceptions
    Type Condition
    InvalidOperationException

    Thrown if requested service cannot be resolved

    Resolve<TService>(IServiceScope, string)

    resolve an instance for the given type from the dependency injection container. will throw if unresolvable.

    Declaration
    public static TService Resolve<TService>(this IServiceScope scope, string keyName) where TService : class
    Parameters
    Type Name Description
    IServiceScope scope
    string keyName
    Returns
    Type Description
    TService
    Type Parameters
    Name Description
    TService

    the type of the service to resolve

    Exceptions
    Type Condition
    InvalidOperationException

    Thrown if requested service cannot be resolved

    TryResolve(IServiceScope, Type)

    try to resolve an instance for the given type from the dependency injection container. will return null if unresolvable.

    Declaration
    public static object? TryResolve(this IServiceScope scope, Type typeOfService)
    Parameters
    Type Name Description
    IServiceScope scope
    Type typeOfService

    the type of the service to resolve

    Returns
    Type Description
    object

    TryResolve(IServiceScope, Type, string)

    try to resolve an instance for the given type from the dependency injection container. will return null if unresolvable.

    Declaration
    public static object? TryResolve(this IServiceScope scope, Type typeOfService, string keyName)
    Parameters
    Type Name Description
    IServiceScope scope
    Type typeOfService

    the type of the service to resolve

    string keyName
    Returns
    Type Description
    object

    TryResolve<TService>(IServiceScope)

    try to resolve an instance for the given type from the dependency injection container. will return null if unresolvable.

    Declaration
    public static TService? TryResolve<TService>(this IServiceScope scope) where TService : class
    Parameters
    Type Name Description
    IServiceScope scope
    Returns
    Type Description
    TService
    Type Parameters
    Name Description
    TService

    the type of the service to resolve

    TryResolve<TService>(IServiceScope, string)

    try to resolve an instance for the given type from the dependency injection container. will return null if unresolvable.

    Declaration
    public static TService? TryResolve<TService>(this IServiceScope scope, string keyName) where TService : class
    Parameters
    Type Name Description
    IServiceScope scope
    string keyName
    Returns
    Type Description
    TService
    Type Parameters
    Name Description
    TService

    the type of the service to resolve

    In this article
    Back to top Developed by Đĵ ΝιΓΞΗΛψΚ and contributors / Licensed under MIT / Website generated by DocFX