using Microsoft.EntityFrameworkCore; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Hosting; using Persistence.Database; using Persistence.Database.Model; namespace Persistence.Repository; public class Startup { public static void BeforeRunHandler(IHost host) { using var scope = host.Services.CreateScope(); var provider = scope.ServiceProvider; var context = provider.GetRequiredService(); context.Database.EnsureCreatedAndMigrated(); } }