Class MongoDBClientFactory
- Namespace
- Cratis.Applications.MongoDB
- Assembly
- Cratis.Applications.MongoDB.dll
Represents an implementation of IMongoDBClientFactory.
[Singleton]
public class MongoDBClientFactory : IMongoDBClientFactory
- Inheritance
-
MongoDBClientFactory
- Implements
- Inherited Members
Remarks
Initializes a new instance of the MongoDBClientFactory class.
Constructors
MongoDBClientFactory(IMongoServerResolver, IMeter<IMongoClient>, IOptions<MongoDBOptions>, ILogger<MongoDBClientFactory>)
Represents an implementation of IMongoDBClientFactory.
public MongoDBClientFactory(IMongoServerResolver serverResolver, IMeter<IMongoClient> meter, IOptions<MongoDBOptions> options, ILogger<MongoDBClientFactory> logger)
Parameters
serverResolver
IMongoServerResolverIMongoServerResolver for resolving the server.
meter
IMeter<IMongoClient>IMeter<T> for metering.
options
IOptions<MongoDBOptions>IOptions<TOptions> for getting the options.
logger
ILogger<MongoDBClientFactory>ILogger for logging.
Remarks
Initializes a new instance of the MongoDBClientFactory class.
Methods
Create()
Create a new MongoDB.Driver.IMongoClient based on IMongoServerResolver.
public IMongoClient Create()
Returns
- IMongoClient
A new MongoDB.Driver.IMongoClient.
Create(MongoClientSettings)
Create a new MongoDB.Driver.IMongoClient from MongoDB.Driver.MongoClientSettings.
public IMongoClient Create(MongoClientSettings settings)
Parameters
settings
MongoClientSettingsMongoDB.Driver.MongoClientSettings to use.
Returns
- IMongoClient
A new MongoDB.Driver.IMongoClient.
Create(MongoUrl)
Create a new MongoDB.Driver.IMongoClient from MongoDB.Driver.MongoUrl.
public IMongoClient Create(MongoUrl url)
Parameters
url
MongoUrlMongoDB.Driver.MongoUrl to use.
Returns
- IMongoClient
A new MongoDB.Driver.IMongoClient.
Create(string)
Create a new MongoDB.Driver.IMongoClient from a connection string.
public IMongoClient Create(string connectionString)
Parameters
connectionString
stringConnection string to use.
Returns
- IMongoClient
A new MongoDB.Driver.IMongoClient.