public static async Task Main(string[] args) { var host = CreateHostBuilder(args).Build(); using (var scope = host.Services.CreateScope()) { var userManager = scope.ServiceProvider.GetRequiredService <UserManager <IdentityUser> >(); var roleManager = scope.ServiceProvider.GetRequiredService <RoleManager <IdentityRole> >(); await DbObject.InitialazeIdentity(userManager, roleManager); } host.Run(); }