Class GaxGrpcServiceCollectionExtensions (4.3.1)

public static class GaxGrpcServiceCollectionExtensions

Extension methods for dependency injection.

Inheritance

object > GaxGrpcServiceCollectionExtensions

Namespace

MicrosoftMicrosoft.ExtensionsDependencyInjection

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, 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.

optionsConfigurerActionIServiceProviderGrpcGrpc.NetGrpc.Net.ClientGrpc.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.