public CatalogContext(ICatalogDatabaseSettings settings)
        {
            var client = new MongoClient(settings.ConnectionString);

            _database = client.GetDatabase(settings.DatabaseName);
            CatalogContextSeed.SeedData(Products);
        }
示例#2
0
        public CatalogContext(IConfiguration configuration)
        {
            var client   = new MongoClient(configuration.GetValue <string>("DatabaseSettings:ConnectionString"));
            var database = client.GetDatabase(configuration.GetValue <string>("DatabaseSettings:DatabaseName"));

            Products = database.GetCollection <Product>(configuration.GetValue <string>("DatabaseSettings:CollectionName"));
            CatalogContextSeed.SeedData(Products);
        }
示例#3
0
        public CatalogContext(ICatalogDbSettings settings)
        {
            var client   = new MongoClient(settings.ConnectionString);
            var database = client.GetDatabase(settings.DatabaseName);

            Products = database.GetCollection <Product>(settings.CollectionName);

            CatalogContextSeed.SeedData(Products);
        }