Working on wiring up identity and basket
This commit is contained in:
@@ -7,6 +7,8 @@ using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Infrastructure.Identity;
|
||||
using Microsoft.AspNetCore.Identity.EntityFrameworkCore;
|
||||
|
||||
namespace Microsoft.eShopWeb
|
||||
{
|
||||
@@ -33,7 +35,7 @@ namespace Microsoft.eShopWeb
|
||||
{
|
||||
try
|
||||
{
|
||||
c.UseSqlServer(Configuration["ConnectionString"]);
|
||||
c.UseSqlServer(Configuration.GetConnectionString("CatalogConnection"));
|
||||
c.ConfigureWarnings(wb =>
|
||||
{
|
||||
//By default, in this application, we don't want to have client evaluations
|
||||
@@ -46,6 +48,15 @@ namespace Microsoft.eShopWeb
|
||||
}
|
||||
});
|
||||
|
||||
// Add Identity DbContext
|
||||
services.AddDbContext<AppIdentityDbContext>(options =>
|
||||
options.UseSqlServer(Configuration.GetConnectionString("IdentityConnection")));
|
||||
|
||||
services.AddIdentity<ApplicationUser, IdentityRole>()
|
||||
.AddEntityFrameworkStores<AppIdentityDbContext>()
|
||||
.AddDefaultTokenProviders();
|
||||
|
||||
|
||||
services.AddTransient<ICatalogService, CatalogService>();
|
||||
services.Configure<CatalogSettings>(Configuration);
|
||||
services.AddMvc();
|
||||
@@ -69,6 +80,8 @@ namespace Microsoft.eShopWeb
|
||||
|
||||
app.UseStaticFiles();
|
||||
|
||||
app.UseIdentity();
|
||||
|
||||
app.UseMvc(routes =>
|
||||
{
|
||||
routes.MapRoute(
|
||||
|
||||
Reference in New Issue
Block a user