示例#1
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);
        }
        public CatalogContext(ICatalogDbSettings catalogDbSettings)
        {
            var client   = new MongoClient(catalogDbSettings.ConnectionString);
            var database = client.GetDatabase(catalogDbSettings.DatabaseName);

            this.Products = database.GetCollection <Product>(catalogDbSettings.CollectionName);
            SeedCatalogContext.SeedData(this.Products);
        }