public CatalogContext(ICatalogDatabaseSettings settings) { var client = new MongoClient(settings.ConnectionString); var database = client.GetDatabase(settings.DatabaseName); Products = database.GetCollection <Product>(settings.CollectionName); CatalogContextSeed.SeedData(Products); }
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); }