public static async Task Main(string[] args) { var host = BuildWebHost(args); using (var scope = host.Services.CreateScope()) { var services = scope.ServiceProvider; var databaseContext = services.GetRequiredService <ApplicationDbContext>(); var userManager = services.GetRequiredService <UserManager <ApplicationUser> >(); var rolesManager = services.GetRequiredService <RoleManager <IdentityRole> >(); await ApplicationDbContextSeed.EnsureSeedData(databaseContext, userManager, rolesManager); } host.Run(); }