Ejemplo n.º 1
0
        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);
        }
Ejemplo n.º 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);
        }