0
0
MyDarling/Program.cs
2023-03-06 07:41:35 +03:00

32 lines
774 B
C#

using Microsoft.EntityFrameworkCore;
using MyDarling.Models;
using Microsoft.AspNetCore.Identity;
var builder = WebApplication.CreateBuilder(args);
builder.Services.AddDbContext<DataContext>(opts =>
{
opts.UseSqlite(builder.Configuration["ConnectionStrings:MyDarlingDb"]);
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();
app.UseStaticFiles();
app.MapControllers();
app.MapDefaultControllerRoute();
app.UseAuthentication();
app.UseAuthorization();
app.Run();