0
0
MyDarling/Program.cs

32 lines
774 B
C#
Raw Normal View History

2023-01-31 15:55:44 +03:00
using Microsoft.EntityFrameworkCore;
using MyDarling.Models;
2023-03-06 07:41:35 +03:00
using Microsoft.AspNetCore.Identity;
2023-01-31 15:55:44 +03:00
2023-01-31 14:54:32 +03:00
var builder = WebApplication.CreateBuilder(args);
2023-01-31 15:55:44 +03:00
2023-02-16 07:23:48 +03:00
builder.Services.AddDbContext<DataContext>(opts =>
2023-01-31 15:55:44 +03:00
{
2023-02-21 07:52:11 +03:00
opts.UseSqlite(builder.Configuration["ConnectionStrings:MyDarlingDb"]);
opts.EnableSensitiveDataLogging(true);
2023-01-31 15:55:44 +03:00
});
2023-02-21 07:52:11 +03:00
2023-03-06 07:41:35 +03:00
builder.Services.AddDbContext<IdentityContext>(opts =>
{
opts.UseSqlite(builder.Configuration["ConnectionStrings:IdentityDb"]);
});
builder.Services.AddIdentity<IdentityUser, IdentityRole>()
.AddEntityFrameworkStores<IdentityContext>();
2023-01-31 14:54:32 +03:00
builder.Services.AddControllersWithViews();
2023-01-31 15:55:44 +03:00
2023-01-31 14:54:32 +03:00
var app = builder.Build();
app.UseStaticFiles();
app.MapControllers();
app.MapDefaultControllerRoute();
2023-03-06 07:41:35 +03:00
app.UseAuthentication();
app.UseAuthorization();
2023-01-31 15:55:44 +03:00
2023-01-31 14:54:32 +03:00
app.Run();