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

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

                try
                {
                    StartupDBInitializer.SeedData(services);
                }
                catch (Exception e)
                {
                    // Use _ILogger to log data
                }

                host.Run();
            }
        }
예제 #2
0
        public static void Main(string[] args)
        {
            var host = CreateWebHostBuilder(args).Build();

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

                try
                {
                    StartupDBInitializer.SeedData(services);
                }
                catch (Exception e)
                {
                    var logger = host.Services.GetRequiredService <ILogger <Program> >();
                    logger.LogInformation(e.ToString());
                }

                host.Run();
            }
        }