public static async Task Main(string[] args) { var host = CreateHostBuilder(args).Build(); using var scope = host.Services.CreateScope(); var services = scope.ServiceProvider; try { var context = services.GetRequiredService <DataContext>(); await context.Database.MigrateAsync(); await Seed.SeedBuyerData(context); await Seed.SeedExhibitorData(context); await Seed.SeedTransactionData(context); } catch (Exception ex) { var logger = services.GetRequiredService <ILogger <Program> >(); logger.LogError(ex, "An error occured during migration"); } await host.RunAsync(); }