Class GrpcClientServiceExtensions
Extensions methods to configure an
Inheritance
Namespace: Microsoft.Extensions.DependencyInjection
Assembly: Grpc.Net.ClientFactory.dll
Syntax
public static class GrpcClientServiceExtensions : object
Methods
AddGrpcClient<TClient>(IServiceCollection)
Adds the TClient type and a named 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 |
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
TClient instances constructed with the appropriate TClient as the service type.
AddGrpcClient<TClient>(IServiceCollection, Action<GrpcClientFactoryOptions>)
Adds the TClient type and a named 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 |
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
TClient instances constructed with the appropriate TClient as the service type.
AddGrpcClient<TClient>(IServiceCollection, Action<IServiceProvider, GrpcClientFactoryOptions>)
Adds the TClient type and a named 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 |
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
TClient instances constructed with the appropriate TClient as the service type.
The 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 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 |
Returns
| Type | Description |
|---|---|
| IHttpClientBuilder | An |
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
TClient instances constructed with the appropriate TClient as the service type.
AddGrpcClient<TClient>(IServiceCollection, String, Action<GrpcClientFactoryOptions>)
Adds 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 |
| Action<GrpcClientFactoryOptions> | configureClient | A delegate that is used to configure the gRPC client. |
Returns
| Type | Description |
|---|---|
| IHttpClientBuilder | An |
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
TClient instances constructed with the appropriate TClient as the service type.
AddGrpcClient<TClient>(IServiceCollection, String, Action<IServiceProvider, GrpcClientFactoryOptions>)
Adds 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 |
| Action<IServiceProvider, GrpcClientFactoryOptions> | configureClient | A delegate that is used to configure the gRPC client. |
Returns
| Type | Description |
|---|---|
| IHttpClientBuilder | An |
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
TClient instances constructed with the appropriate TClient as the service type.
The configureClient will be
a reference to a scoped service provider that shares the lifetime of the handler being constructed.