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
|
|
|
|
2023-02-16 07:23:48 +03:00
|
|
|
builder.Services.AddDbContext<DataContext>(opts =>
|
2023-01-31 15:55:44 +03:00
|
|
|
{
|
2023-02-16 07:23:48 +03:00
|
|
|
opts.UseSqlite(builder.Configuration["ConnectionStrings:MyDarlingDb"]);
|
|
|
|
opts.EnableSensitiveDataLogging(true);
|
2023-01-31 15:55:44 +03:00
|
|
|
});
|
2023-02-16 07:23:48 +03:00
|
|
|
builder.Services.AddSingleton<IRepository, MyDarlingRepository>();
|
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-02-16 07:23:48 +03:00
|
|
|
// var context = app.Services.CreateScope().ServiceProvider.GetRequiredService<DataContext>();
|
|
|
|
// SeedData.SeedDatabase(context);
|
2023-01-31 15:55:44 +03:00
|
|
|
|
2023-01-31 14:54:32 +03:00
|
|
|
app.Run();
|