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
optionsIOptions<MongoDBOptions>The IOptions<TOptions> for MongoDBOptions.
connectionResolversIConnectionResolversThe IConnectionResolvers shared with the other storage integrations.
serverResolverIMongoServerResolverThe IMongoServerResolver giving the configured server.
databaseNameResolverIMongoDatabaseNameResolverThe IMongoDatabaseNameResolver giving the database name when none is resolved.
tenantIdAccessorITenantIdAccessorThe ITenantIdAccessor.
clientFactoryIMongoDBClientFactoryThe 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.