public static async Task InitializeDatabase(IServiceScope serviceScope) { var userManager = serviceScope.ServiceProvider.GetRequiredService <UserManager <ApplicationUser> >(); var databaseInitializer = new DatabaseInitializer(userManager); await databaseInitializer.InitializeDatabase(); }