0
0
MyDarling/Program.cs

22 lines
539 B
C#
Raw Normal View History

2023-01-31 15:55:44 +03:00
using Microsoft.EntityFrameworkCore;
using MyDarling.Models;
2023-01-31 14:54:32 +03:00
var builder = WebApplication.CreateBuilder(args);
2023-01-31 15:55:44 +03:00
builder.Services.AddDbContext<DataContext>(opts =>
{
opts.UseSqlite(builder.Configuration["ConnectionStrings:MyDarlingDb"]);
opts.EnableSensitiveDataLogging(true);
});
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-01-31 15:55:44 +03:00
var context = app.Services.CreateScope().ServiceProvider.GetRequiredService<DataContext>();
2023-01-31 14:54:32 +03:00
app.Run();