Google.Cloud.Spanner.Data - Class ServiceCollectionExtensions (4.2.0)

public static class ServiceCollectionExtensions

Reference documentation and code samples for the Google.Cloud.Spanner.Data class ServiceCollectionExtensions.

Provides extension methods to configure dependency injection with Spanner.

Inheritance

Object > ServiceCollectionExtensions

Namespace

Microsoft.Extensions.DependencyInjection

Assembly

Google.Cloud.Spanner.Data.dll

Methods

AddSpannerConnection(IServiceCollection, String)

public static IServiceCollection AddSpannerConnection(this IServiceCollection services, string connectionStringName)

Adds a transient service providing a SpannerConnection using the ConnectionStrings section of the configuration. If the container providers a ChannelCredentials or GoogleCredential, this will be used for the connection (with ChannelCredentials taking precedence).

Parameters
NameDescription
servicesIServiceCollection

The service collection to add the transient dependency to.

connectionStringNameString

The name of the the connection string within the ConnectionStrings section of the configuration. Must not be null or empty.

Returns
TypeDescription
IServiceCollection

The same service collection (services), for method chaining.