0
0
MyDarling/Program.cs
2023-02-01 09:26:53 +03:00

22 lines
570 B
C#

using Microsoft.EntityFrameworkCore;
using MyDarling.Models;
var builder = WebApplication.CreateBuilder(args);
builder.Services.AddDbContext<DataContext>(opts =>
{
opts.UseSqlite(builder.Configuration["ConnectionStrings:MyDarlingDb"]);
opts.EnableSensitiveDataLogging(true);
});
builder.Services.AddControllersWithViews();
var app = builder.Build();
app.UseStaticFiles();
app.MapControllers();
app.MapDefaultControllerRoute();
var context = app.Services.CreateScope().ServiceProvider.GetRequiredService<DataContext>();
SeedData.SeedDatabase(context);
app.Run();