Working on wiring up identity and basket

This commit is contained in:
Steve Smith
2017-04-20 17:04:03 -04:00
parent 6694aa4968
commit 408c5d97ec
12 changed files with 301 additions and 4 deletions

View File

@@ -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(