Class GaxGrpcServiceCollectionExtensions (4.4.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
Name Description
services IServiceCollection

The service collection to add the adapter to.

Returns
Type Description
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 GrpcChannel created uses the service provider from created this service collection. This enables logging, for example.

Parameter
Name Description
services IServiceCollection

The service collection to add the adapter to.

Returns
Type Description
IServiceCollection

The same service collection reference, for method chaining.

AddGrpcNetClientAdapter(IServiceCollection, Action<IServiceProvider, GrpcChannelOptions>)

public static IServiceCollection AddGrpcNetClientAdapter(this IServiceCollection services, Action<IServiceProvider, 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 ServiceProvider is set to the provider. This enables logging, for example.

Parameters
Name Description
services IServiceCollection

The service collection to add the adapter to.

optionsConfigurer ActionIServiceProviderGrpcChannelOptions

The configuration action to perform on each GrpcChannelOptions 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
Type Description
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
Name Description
services IServiceCollection

The service collection to add the adapter to.

Returns
Type Description
IServiceCollection

The same service collection reference, for method chaining.