diff options
Diffstat (limited to 'Program.cs')
-rw-r--r-- | Program.cs | 13 |
1 files changed, 11 insertions, 2 deletions
@@ -1,5 +1,6 @@ using Microsoft.EntityFrameworkCore; using MyDarling.Models; +using Microsoft.AspNetCore.Identity; var builder = WebApplication.CreateBuilder(args); @@ -9,6 +10,14 @@ builder.Services.AddDbContext<DataContext>(opts => opts.EnableSensitiveDataLogging(true); }); +builder.Services.AddDbContext<IdentityContext>(opts => +{ + opts.UseSqlite(builder.Configuration["ConnectionStrings:IdentityDb"]); +}); + +builder.Services.AddIdentity<IdentityUser, IdentityRole>() + .AddEntityFrameworkStores<IdentityContext>(); + builder.Services.AddControllersWithViews(); var app = builder.Build(); @@ -17,7 +26,7 @@ app.UseStaticFiles(); app.MapControllers(); app.MapDefaultControllerRoute(); -// var context = app.Services.CreateScope().ServiceProvider.GetRequiredService<DataContext>(); -// SeedData.SeedDatabase(context); +app.UseAuthentication(); +app.UseAuthorization(); app.Run();
\ No newline at end of file |