feat: add and initialize work with the database

This commit is contained in:
Polianin Nikita 2024-01-26 19:36:18 +03:00
parent 98ebe5ffdb
commit 2b02cfb616

View File

@ -42,7 +42,8 @@ public class Program
builder.Configuration.AddConfiguration(ConfigureEnvironment());
builder.Configuration.AddJsonFile(Settings.FilePath, optional: true, reloadOnChange: true);
// Add services to the container.
builder.Services.AddApplication();
builder.Services.AddPersistence(builder.Configuration);
builder.Services.AddControllers();
builder.Services.AddCors(options =>
@ -89,6 +90,10 @@ public class Program
foreach (var item in app.Configuration.AsEnumerable())
Console.WriteLine($"{item.Key}:{item.Value}");
#endif
var uber = app.Services.CreateScope().ServiceProvider.GetService<UberDbContext>();
DbInitializer.Initialize(uber!);
// Configure the HTTP request pipeline.
if (app.Environment.IsDevelopment())
{