Search Results for

    Show / Hide Table of Contents

    Class Group

    common configuration for a group of endpoints can be specified by implementing this abstract class and calling Configure(string, Action<EndpointDefinition>) in the constructor.

    Inheritance
    object
    Group
    SubGroup<TParent>
    Implements
    IServiceResolverBase
    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 abstract class Group : IServiceResolverBase

    Methods

    Configure(string, Action<EndpointDefinition>)

    call this method in the constructor in order to configure the endpoint group.

    Declaration
    protected virtual void Configure(string routePrefix, Action<EndpointDefinition> ep)
    Parameters
    Type Name Description
    string routePrefix

    the route prefix for the group

    Action<EndpointDefinition> ep

    the configuration action to be performed on the EndpointDefinition

    CreateScope()

    if you'd like to resolve scoped or transient services from the MS DI container, obtain a service scope from this method and dispose the scope when the work is complete.

    <pre><code class="lang-csharp">using var scope = CreateScope();
    var scopedService = scope.Resolve<MyService>();</code></pre>
    
    Declaration
    public IServiceScope CreateScope()
    Returns
    Type Description
    IServiceScope

    Resolve(Type)

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

    Declaration
    public object Resolve(Type typeOfService)
    Parameters
    Type Name Description
    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(Type, string)

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

    Declaration
    public object Resolve(Type typeOfService, string keyName)
    Parameters
    Type Name Description
    Type typeOfService

    the type of the service to resolve

    string keyName

    the key name for resolving keyed service

    Returns
    Type Description
    object
    Exceptions
    Type Condition
    InvalidOperationException

    Thrown if requested service cannot be resolved

    Resolve<TService>()

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

    Declaration
    public TService Resolve<TService>() where TService : class
    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>(string)

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

    Declaration
    public TService Resolve<TService>(string keyName) where TService : class
    Parameters
    Type Name Description
    string keyName

    the key name for resolving keyed service

    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(Type)

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

    Declaration
    public object? TryResolve(Type typeOfService)
    Parameters
    Type Name Description
    Type typeOfService

    the type of the service to resolve

    Returns
    Type Description
    object

    TryResolve(Type, string)

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

    Declaration
    public object? TryResolve(Type typeOfService, string keyName)
    Parameters
    Type Name Description
    Type typeOfService

    the type of the service to resolve

    string keyName

    the key name for resolving keyed service

    Returns
    Type Description
    object

    TryResolve<TService>()

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

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

    the type of the service to resolve

    TryResolve<TService>(string)

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

    Declaration
    public TService? TryResolve<TService>(string keyName) where TService : class
    Parameters
    Type Name Description
    string keyName

    the key name for resolving keyed service

    Returns
    Type Description
    TService
    Type Parameters
    Name Description
    TService

    the type of the service to resolve

    Implements

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