API Traieste

This commit is contained in:
andrei-mihnea-cerbu
2024-04-04 19:21:03 +03:00
parent 22f171b560
commit 1206db9321
104 changed files with 359 additions and 366 deletions
+2 -2
View File
@@ -28,13 +28,13 @@ app.MapControllers();
using (var scope = app.Services.CreateScope())
{
var services = scope.ServiceProvider;
var dbContext = services.GetRequiredService<HealthcareManagerContext>(); // Directly resolving your DbContext
var dbContext = services.GetRequiredService<HealthcareManagerDatabase>(); // Directly resolving your DbContext
EnsureDatabaseCreated(dbContext);
}
app.Run();
static void EnsureDatabaseCreated(HealthcareManagerContext dbContext)
static void EnsureDatabaseCreated(HealthcareManagerDatabase dbContext)
{
// Checking for pending migrations is more efficient than applying migrations unconditionally
if (dbContext.Database.GetPendingMigrations().Any())