32 lines
774 B
C#
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(); |