Firestore API - Class ServiceCollectionExtensions (3.8.0)

public static class ServiceCollectionExtensions

Reference documentation and code samples for the Firestore API class ServiceCollectionExtensions.

Provides extension methods to configure dependency injection with Firestore.

Inheritance

object > ServiceCollectionExtensions

Namespace

Microsoft.Extensions.DependencyInjection

Assembly

Google.Cloud.Firestore.dll

Methods

AddFirestoreDb(IServiceCollection, Action<FirestoreDbBuilder>)

public static IServiceCollection AddFirestoreDb(this IServiceCollection services, Action<FirestoreDbBuilder> action)

Adds a singleton FirestoreDb to the IServiceCollection as customized by the action.

Parameters
Name Description
services IServiceCollection

The IServiceCollection to add the singleton client to.

action ActionFirestoreDbBuilder

An action to invoke on the FirestoreDbBuilder for configuring the FirestoreDb. This is invoked before services are used. Must not be null and must set at least ProjectId.

Returns
Type Description
IServiceCollection

The updated IServiceCollection, for method chaining.

AddFirestoreDb(IServiceCollection, Action<IServiceProvider, FirestoreDbBuilder>)

public static IServiceCollection AddFirestoreDb(this IServiceCollection services, Action<IServiceProvider, FirestoreDbBuilder> action)

Adds a singleton FirestoreDb to the IServiceCollection as customized by the action.

Parameters
Name Description
services IServiceCollection

The IServiceCollection to add the singleton client to.

action ActionIServiceProviderFirestoreDbBuilder

An action to invoke on the FirestoreDbBuilder for configuring the FirestoreDb. This is invoked before services are used. Must not be null and must set at least ProjectId.

Returns
Type Description
IServiceCollection

The updated IServiceCollection, for method chaining.

AddFirestoreDb(IServiceCollection, string)

public static IServiceCollection AddFirestoreDb(this IServiceCollection services, string projectId)

Adds a singleton FirestoreDb for with the specified project ID, using default settings to the IServiceCollection.

Parameters
Name Description
services IServiceCollection

The IServiceCollection to add the singleton client to.

projectId string

The project ID. Must not be null.

Returns
Type Description
IServiceCollection

The updated IServiceCollection, for method chaining.