Merge remote-tracking branch 'origin/master'

This commit is contained in:
Steve Smith
2018-06-07 15:50:38 -04:00
2 changed files with 9 additions and 18 deletions

View File

@@ -35,8 +35,6 @@ namespace Microsoft.eShopWeb.Web
// use real database // use real database
// ConfigureProductionServices(services); // ConfigureProductionServices(services);
ConfigureServices(services);
} }
private void ConfigureInMemoryDatabases(IServiceCollection services) private void ConfigureInMemoryDatabases(IServiceCollection services)
@@ -48,24 +46,17 @@ namespace Microsoft.eShopWeb.Web
// Add Identity DbContext // Add Identity DbContext
services.AddDbContext<AppIdentityDbContext>(options => services.AddDbContext<AppIdentityDbContext>(options =>
options.UseInMemoryDatabase("Identity")); options.UseInMemoryDatabase("Identity"));
ConfigureServices(services);
} }
public void ConfigureProductionServices(IServiceCollection services) public void ConfigureProductionServices(IServiceCollection services)
{ {
// use real database // use real database
services.AddDbContext<CatalogContext>(c =>
{
try
{
// Requires LocalDB which can be installed with SQL Server Express 2016 // Requires LocalDB which can be installed with SQL Server Express 2016
// https://www.microsoft.com/en-us/download/details.aspx?id=54284 // https://www.microsoft.com/en-us/download/details.aspx?id=54284
c.UseSqlServer(Configuration.GetConnectionString("CatalogConnection")); services.AddDbContext<CatalogContext>(c =>
} c.UseSqlServer(Configuration.GetConnectionString("CatalogConnection")));
catch (Exception ex)
{
//TODO: log the exception details
}
});
// Add Identity DbContext // Add Identity DbContext
services.AddDbContext<AppIdentityDbContext>(options => services.AddDbContext<AppIdentityDbContext>(options =>

View File

@@ -1,7 +1,7 @@
{ {
"ConnectionStrings": { "ConnectionStrings": {
"CatalogConnection": "Server=(localdb)\\v11.0;Integrated Security=true;Initial Catalog=Microsoft.eShopOnWeb.CatalogDb;", "CatalogConnection": "Server=(localdb)\\mssqllocaldb;Integrated Security=true;Initial Catalog=Microsoft.eShopOnWeb.CatalogDb;",
"IdentityConnection": "Server=(localdb)\\v11.0;Integrated Security=true;Initial Catalog=Microsoft.eShopOnWeb.Identity;" "IdentityConnection": "Server=(localdb)\\mssqllocaldb;Integrated Security=true;Initial Catalog=Microsoft.eShopOnWeb.Identity;"
}, },
"CatalogBaseUrl": "", "CatalogBaseUrl": "",
"Logging": { "Logging": {