Show / Hide Table of Contents

    Class GrpcClientServiceExtensions

    Extensions methods to configure an for with gRPC.

    Inheritance
    System.Object
    GrpcClientServiceExtensions
    Namespace: Microsoft.Extensions.DependencyInjection
    Assembly: Grpc.Net.ClientFactory.dll
    Syntax
    public static class GrpcClientServiceExtensions : object

    Methods

    AddGrpcClient<TClient>(IServiceCollection)

    Adds the and related services to the and configures a binding between the TClient type and a named . The client name will be set to the type name of TClient.

    Declaration
    public static IHttpClientBuilder AddGrpcClient<TClient>(this IServiceCollection services)
        where TClient : ClientBase
    Parameters
    Type Name Description
    IServiceCollection services

    The .

    Returns
    Type Description
    IHttpClientBuilder

    An that can be used to configure the client.

    Type Parameters
    Name Description
    TClient

    The type of the gRPC client. The type specified will be registered in the service collection as a transient service.

    Remarks

    instances that apply the provided configuration can be retrieved using and providing the matching name.

    TClient instances constructed with the appropriate can be retrieved from (and related methods) by providing TClient as the service type.

    AddGrpcClient<TClient>(IServiceCollection, Action<GrpcClientFactoryOptions>)

    Adds the and related services to the and configures a binding between the TClient type and a named . The client name will be set to the type name of TClient.

    Declaration
    public static IHttpClientBuilder AddGrpcClient<TClient>(this IServiceCollection services, Action<GrpcClientFactoryOptions> configureClient)
        where TClient : ClientBase
    Parameters
    Type Name Description
    IServiceCollection services

    The .

    Action<GrpcClientFactoryOptions> configureClient

    A delegate that is used to configure the gRPC client.

    Returns
    Type Description
    IHttpClientBuilder

    An that can be used to configure the client.

    Type Parameters
    Name Description
    TClient

    The type of the gRPC client. The type specified will be registered in the service collection as a transient service.

    Remarks

    instances that apply the provided configuration can be retrieved using and providing the matching name.

    TClient instances constructed with the appropriate can be retrieved from (and related methods) by providing TClient as the service type.

    AddGrpcClient<TClient>(IServiceCollection, Action<IServiceProvider, GrpcClientFactoryOptions>)

    Adds the and related services to the and configures a binding between the TClient type and a named . The client name will be set to the type name of TClient.

    Declaration
    public static IHttpClientBuilder AddGrpcClient<TClient>(this IServiceCollection services, Action<IServiceProvider, GrpcClientFactoryOptions> configureClient)
        where TClient : ClientBase
    Parameters
    Type Name Description
    IServiceCollection services

    The .

    Action<IServiceProvider, GrpcClientFactoryOptions> configureClient

    A delegate that is used to configure the gRPC client.

    Returns
    Type Description
    IHttpClientBuilder

    An that can be used to configure the client.

    Type Parameters
    Name Description
    TClient

    The type of the gRPC client. The type specified will be registered in the service collection as a transient service.

    Remarks

    instances that apply the provided configuration can be retrieved using and providing the matching name.

    TClient instances constructed with the appropriate can be retrieved from (and related methods) by providing TClient as the service type.

    The argument provided to configureClient will be a reference to a scoped service provider that shares the lifetime of the handler being constructed.

    AddGrpcClient<TClient>(IServiceCollection, String)

    Adds the and related services to the and configures a binding between the TClient type and a named .

    Declaration
    public static IHttpClientBuilder AddGrpcClient<TClient>(this IServiceCollection services, string name)
        where TClient : ClientBase
    Parameters
    Type Name Description
    IServiceCollection services

    The .

    System.String name

    The logical name of the to configure.

    Returns
    Type Description
    IHttpClientBuilder

    An that can be used to configure the client.

    Type Parameters
    Name Description
    TClient

    The type of the gRPC client. The type specified will be registered in the service collection as a transient service.

    Remarks

    instances that apply the provided configuration can be retrieved using and providing the matching name.

    TClient instances constructed with the appropriate can be retrieved from (and related methods) by providing TClient as the service type.

    AddGrpcClient<TClient>(IServiceCollection, String, Action<GrpcClientFactoryOptions>)

    Adds the and related services to the and configures a binding between the TClient type and a named .

    Declaration
    public static IHttpClientBuilder AddGrpcClient<TClient>(this IServiceCollection services, string name, Action<GrpcClientFactoryOptions> configureClient)
        where TClient : ClientBase
    Parameters
    Type Name Description
    IServiceCollection services

    The .

    System.String name

    The logical name of the to configure.

    Action<GrpcClientFactoryOptions> configureClient

    A delegate that is used to configure the gRPC client.

    Returns
    Type Description
    IHttpClientBuilder

    An that can be used to configure the client.

    Type Parameters
    Name Description
    TClient

    The type of the gRPC client. The type specified will be registered in the service collection as a transient service.

    Remarks

    instances that apply the provided configuration can be retrieved using and providing the matching name.

    TClient instances constructed with the appropriate can be retrieved from (and related methods) by providing TClient as the service type.

    AddGrpcClient<TClient>(IServiceCollection, String, Action<IServiceProvider, GrpcClientFactoryOptions>)

    Adds the and related services to the and configures a binding between the TClient type and a named .

    Declaration
    public static IHttpClientBuilder AddGrpcClient<TClient>(this IServiceCollection services, string name, Action<IServiceProvider, GrpcClientFactoryOptions> configureClient)
        where TClient : ClientBase
    Parameters
    Type Name Description
    IServiceCollection services

    The .

    System.String name

    The logical name of the to configure.

    Action<IServiceProvider, GrpcClientFactoryOptions> configureClient

    A delegate that is used to configure the gRPC client.

    Returns
    Type Description
    IHttpClientBuilder

    An that can be used to configure the client.

    Type Parameters
    Name Description
    TClient

    The type of the gRPC client. The type specified will be registered in the service collection as a transient service.

    Remarks

    instances that apply the provided configuration can be retrieved using and providing the matching name.

    TClient instances constructed with the appropriate can be retrieved from (and related methods) by providing TClient as the service type.

    The argument provided to configureClient will be a reference to a scoped service provider that shares the lifetime of the handler being constructed.

    Back to top Generated by DocFX