0
0
MyDarling/Program.cs
Sergey Chebotar a9e52b199b Database init
2023-01-31 15:55:44 +03:00

22 lines
539 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>();
app.Run();