Ejemplo n.º 1
0
        public static void Main(string[] args)
        {
            var host = CreateHostBuilder(args).Build();

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

                try
                {
                    var ctx = services.GetRequiredService <DataContext>();
                    ctx.Database.Migrate();
                    Seed.CountrySeed(ctx);
                }
                catch (Exception ex)
                {
                    var logger = services.GetRequiredService <ILogger <Program> >();
                    logger.LogError(ex, "An Error Occured During Migration...");
                }
            }

            host.Run();
        }