Example #1
0
        public async static Task Main(string[] args)
        {
            var host = CreateHostBuilder(args)
                       .ConfigureAppConfiguration((hostContext, builder) =>
            {
                if (hostContext.HostingEnvironment.IsDevelopment())
                {
                    builder.AddUserSecrets <Program>();
                }
            })
                       .Build();

            using (var scope = host.Services.CreateScope())
            {
                var services = scope.ServiceProvider;

                var context     = services.GetRequiredService <TradeTrackerIdentityDbContext>();
                var userManager = services.GetRequiredService <UserManager <ApplicationUser> >();

                context.Database.EnsureCreated();

                await UserCreator.SeedAsync(userManager);
            }

            host.Run();
        }