Merge remote-tracking branch 'origin/master'
This commit is contained in:
@@ -35,37 +35,28 @@ 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)
|
||||||
{
|
{
|
||||||
// use in-memory database
|
// use in-memory database
|
||||||
services.AddDbContext<CatalogContext>(c =>
|
services.AddDbContext<CatalogContext>(c =>
|
||||||
c.UseInMemoryDatabase("Catalog"));
|
c.UseInMemoryDatabase("Catalog"));
|
||||||
|
|
||||||
// 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 =>
|
||||||
@@ -117,7 +108,7 @@ namespace Microsoft.eShopWeb.Web
|
|||||||
}
|
}
|
||||||
|
|
||||||
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
|
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
|
||||||
public void Configure(IApplicationBuilder app,
|
public void Configure(IApplicationBuilder app,
|
||||||
IHostingEnvironment env)
|
IHostingEnvironment env)
|
||||||
{
|
{
|
||||||
if (env.IsDevelopment())
|
if (env.IsDevelopment())
|
||||||
|
|||||||
@@ -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": {
|
||||||
|
|||||||
Reference in New Issue
Block a user