Exemplo n.º 1
0
 public BaseMongoStore(IConfiguration configuration)
 {
     _configuration      = configuration;
     _mongoConfiguration = new Lazy <MongoConfiguration>(() =>
     {
         var mongoConfiguration = new MongoConfiguration();
         _configuration.GetSection("MongoStore").Bind(mongoConfiguration);
         return(mongoConfiguration);
     });
 }
Exemplo n.º 2
0
        public BaseMongoStore(string collectionName, IConfiguration configuration)
        {
            _collectionName = collectionName;
            _configuration  = configuration;

            _mongoConfiguration = new Lazy <MongoConfiguration>(() =>
            {
                var mongoConfiguration = new MongoConfiguration();
                _configuration.GetSection("MongoStore").Bind(mongoConfiguration);
                return(mongoConfiguration);
            });

            _getCollection = new Lazy <IMongoCollection <T> >(() =>
            {
                return(GetDatabase().GetCollection <T>(_collectionName));
            });
        }