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

            using (var scope = host.Services.CreateScope())
            {
                try
                {
                    var concreteAvioContext = scope.ServiceProvider.GetService <AvioDbContext>();
                    AvioDbInitializer.Initialize(concreteAvioContext);
                }
                catch (Exception ex)
                {
                    var logger = scope.ServiceProvider.GetRequiredService <ILogger <Program> >();
                    logger.LogError(ex, "An error occurred while migrating or initializing the database.");
                }
            }

            host.Run();
        }
Exemplo n.º 2
0
        public static void Initialize(AvioDbContext context)
        {
            var initializer = new AvioDbInitializer();

            initializer.SeedEverything(context);
        }