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

View File

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