Class GaxGrpcServiceCollectionExtensions (4.2.0)

public static class GaxGrpcServiceCollectionExtensions

Extension methods for dependency injection.

Inheritance

Object > GaxGrpcServiceCollectionExtensions

Namespace

Microsoft.Extensions.DependencyInjection

Assembly

Google.Api.Gax.Grpc.dll

Methods

AddGrpcCoreAdapter(IServiceCollection)

public static IServiceCollection AddGrpcCoreAdapter(this IServiceCollection services)

Adds a singleton GrpcCoreAdapter to the given service collection as the preferred GrpcAdapter implementation.

Parameter
NameDescription
servicesIServiceCollection

The service collection to add the adapter to.

Returns
TypeDescription
IServiceCollection

The same service collection reference, for method chaining.

AddGrpcNetClientAdapter(IServiceCollection)

public static IServiceCollection AddGrpcNetClientAdapter(this IServiceCollection services)

Adds a singleton GrpcNetClientAdapter to the given service collection as the preferred GrpcAdapter implementation, such that any created uses the service provider from created this service collection. This enables logging, for example.

Parameter
NameDescription
servicesIServiceCollection

The service collection to add the adapter to.

Returns
TypeDescription
IServiceCollection

The same service collection reference, for method chaining.

AddGrpcNetClientAdapter(IServiceCollection, Action<IServiceProvider, Grpc.Net.Client.GrpcChannelOptions>)

public static IServiceCollection AddGrpcNetClientAdapter(this IServiceCollection services, Action<IServiceProvider, Grpc.Net.Client.GrpcChannelOptions> optionsConfigurer)

Adds a singleton GrpcNetClientAdapter to the given service collection as the preferred GrpcAdapter implementation, using the default instance with any additional options configured via optionsConfigurer. Before executing the specified action, the is set to the provider. This enables logging, for example.

Parameters
NameDescription
servicesIServiceCollection

The service collection to add the adapter to.

optionsConfigurerAction<IServiceProvider, Grpc.Net.Client.GrpcChannelOptions>

The configuration action to perform on each when it is used by the adapter to construct a channel. May be null, in which case this method only sets the service provider.

Returns
TypeDescription
IServiceCollection

The same service collection reference, for method chaining.

AddRestGrpcAdapter(IServiceCollection)

public static IServiceCollection AddRestGrpcAdapter(this IServiceCollection services)

Adds a singleton RestGrpcAdapter to the given service collection as the preferred GrpcAdapter implementation.

Parameter
NameDescription
servicesIServiceCollection

The service collection to add the adapter to.

Returns
TypeDescription
IServiceCollection

The same service collection reference, for method chaining.