Google.Cloud.Spanner.Data - Class ServiceCollectionExtensions (5.0.0-beta03)

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
Name Description
services IServiceCollection

The service collection to add the transient dependency to.

connectionStringName string

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

Returns
Type Description
IServiceCollection

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