summaryrefslogtreecommitdiff
path: root/Program.cs
blob: 4079b2b8ac52f6b4cdbc3f47799b427f0730c319 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
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();