public static IApplicationBuilder MigrateDatabase(this IApplicationBuilder app, IHostingEnvironment env) { using (var serviceScope = app.ApplicationServices.CreateScope()) { var dbContext = serviceScope.ServiceProvider.GetRequiredService <ApplicationDbContext>(); if (env.IsDevelopment()) { dbContext.Database.Migrate(); } DbSeeder.SeedBudgetData(dbContext); } return(app); }