예제 #1
0
        static IMongoDatabase GetDatabase(MongoDbOptions dbOptions)
        {
            var client = new MongoClient(dbOptions.ConnectionString);

            return(client.GetDatabase(dbOptions.Database));
        }
예제 #2
0
 /// <inheritdoc />
 public MongoDatabase(IOptions <MongoDbOptions> mongoDbOptions, ILogger <MongoDatabase> logger)
 {
     _mongoDbOptions = mongoDbOptions?.Value ?? throw new ArgumentNullException(nameof(mongoDbOptions));
     _logger         = logger ?? throw new ArgumentNullException(nameof(logger));
 }