Class MongoDBClientFactory
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
serverResolverIMongoServerResolverIMongoServerResolver for resolving the server.
meterIMeter<IMongoClient>IMeter<T> for metering.
optionsIOptions<MongoDBOptions>IOptions<TOptions> for getting the options.
loggerILogger<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
settingsMongoClientSettingsMongoDB.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
urlMongoUrlMongoDB.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
connectionStringstringConnection string to use.
Returns
- IMongoClient
A new MongoDB.Driver.IMongoClient.