Beispiel #1
0
        public static async Task Main(string[] args)
        {
            var host = CreateHostBuilder(args).Build();

            using (var scope = host.Services.CreateScope())
            {
                var services = scope.ServiceProvider;
                try
                {
                    var configuration       = services.GetRequiredService <IConfiguration>();
                    var dbContext           = services.GetRequiredService <TradingPlatformDbContext>();
                    var userManager         = services.GetRequiredService <UserManager <User> >();
                    var rolesManager        = services.GetRequiredService <RoleManager <IdentityRole> >();
                    var identityInitializer = new IdentityInitializer(configuration, dbContext, userManager, rolesManager);
                    await identityInitializer.InitAsync();
                }
                catch (Exception e)
                {
                    Console.WriteLine(e.Message);
                }
            }

            await host.RunAsync();
        }