Exemple #1
0
        public static void Main(string[] args)
        {
            var webHost = CreateWebHostBuilder(args).Build();

            DbInitialzer.Seed();
            webHost.Run();
        }
Exemple #2
0
        public static void Main(string[] args)
        {
            //CreateHostBuilder(args).Build().Run();
            var host = CreateHostBuilder(args).Build();

            using (var secop = host.Services.CreateScope())
            {
                var services = secop.ServiceProvider;
                try
                {
                    var context = services.GetRequiredService <AppDbContext>();
                    DbInitialzer.seed(context);
                }
                catch (Exception e)
                {
                    Console.WriteLine(e.Message);
                }
            }

            host.Run();
        }