|
|
@ -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
|
|
|
|
|
|
// 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 => |
|
|
services.AddDbContext<CatalogContext>(c => |
|
|
{ |
|
|
c.UseSqlServer(Configuration.GetConnectionString("CatalogConnection"))); |
|
|
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
|
|
|
|
|
|
} |
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
// Add Identity DbContext
|
|
|
// Add Identity DbContext
|
|
|
services.AddDbContext<AppIdentityDbContext>(options => |
|
|
services.AddDbContext<AppIdentityDbContext>(options => |
|
|
|