Beispiel #1
0
        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());
        }
Beispiel #2
0
        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);
        }