private async Task <List <string> > GetMongoCollectionsAsync(ILogger logger) { var db = GetMongoDatabase(); var collections = await MongoDbRetryPolicy.GetRetryPolicy(logger).ExecuteAsync(context => db.ListCollectionNames().ToListAsync() , new Context(nameof(GetMongoCollectionsAsync))); return(collections.Select(c => c.ToLower()).ToList()); }
protected MongoDbCollectionBase(ILoggerFactory loggerFactory, string dbName, string collectionName, IOptions <MongoDbConnectionDetails> config) { _dbName = dbName; _collectionName = collectionName; _config = config.Value; Logger = loggerFactory.CreateLogger(this.GetType().FullName); _mongoCommandLogger = new Lazy <ILogger>(() => loggerFactory.CreateLogger("Mongo command")); RetryPolicy = MongoDbRetryPolicy.GetRetryPolicy(Logger); }