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();
            }
        }
Esempio n. 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();
            }
        }