Configure ASP.NET for the API to work #7

Merged
Wesser merged 17 commits from feat/setting-up-asp into release/v1.0.0 2024-01-26 20:41:01 +03:00
Showing only changes of commit 2b02cfb616 - Show all commits

View File

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