Google.Cloud.Spanner.Data - Class ServiceCollectionExtensions (4.4.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

MicrosoftMicrosoft.ExtensionsDependencyInjection

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.