Class MongoDBConnections

Namespace
Cratis.Arc.MongoDB
Assembly
Cratis.Arc.MongoDB.dll

Represents an implementation of IMongoDBConnections.

[Singleton]
public class MongoDBConnections : IMongoDBConnections
Inheritance
MongoDBConnections
Implements
Inherited Members
Extension Methods

Remarks

Resolves through ConnectionResolution when it is configured, else through the application-wide ConnectionResolution. Without either, the connection is the one IMongoServerResolver and IMongoDatabaseNameResolver describe — exactly as without this type. Holds no tenant state of its own: every resolution reads the current tenant, and everything kept is keyed by it.

Constructors

MongoDBConnections(IOptions<MongoDBOptions>, IConnectionResolvers, IMongoServerResolver, IMongoDatabaseNameResolver, ITenantIdAccessor, IMongoDBClientFactory)

Represents an implementation of IMongoDBConnections.

public MongoDBConnections(IOptions<MongoDBOptions> options, IConnectionResolvers connectionResolvers, IMongoServerResolver serverResolver, IMongoDatabaseNameResolver databaseNameResolver, ITenantIdAccessor tenantIdAccessor, IMongoDBClientFactory clientFactory)

Parameters

options IOptions<MongoDBOptions>

The IOptions<TOptions> for MongoDBOptions.

connectionResolvers IConnectionResolvers

The IConnectionResolvers shared with the other storage integrations.

serverResolver IMongoServerResolver

The IMongoServerResolver giving the configured server.

databaseNameResolver IMongoDatabaseNameResolver

The IMongoDatabaseNameResolver giving the database name when none is resolved.

tenantIdAccessor ITenantIdAccessor

The ITenantIdAccessor.

clientFactory IMongoDBClientFactory

The IMongoDBClientFactory creating the clients.

Remarks

Resolves through ConnectionResolution when it is configured, else through the application-wide ConnectionResolution. Without either, the connection is the one IMongoServerResolver and IMongoDatabaseNameResolver describe — exactly as without this type. Holds no tenant state of its own: every resolution reads the current tenant, and everything kept is keyed by it.

Methods

Resolve()

Resolve the connection for the current tenant.

public MongoDBConnection Resolve()

Returns

MongoDBConnection

The resolved MongoDBConnection.