Esempio n. 1
0
        public static void Main(string[] args)
        {
            var host = BuildWebHost(args);

            using (var scope = host.Services.CreateScope())
            {
                var services = scope.ServiceProvider;
                try
                {
                    var dbContext = services.GetRequiredService <EventProjectDbContext>();

                    ProfileDbTableInitializer.Initialize(dbContext);
                    EventDbTableInitializer.Initialize(dbContext);
                    EventProfileDbTableInitializer.Initialize(dbContext);
                }
                catch (Exception ex)
                {
                    var logger = services.GetRequiredService <ILogger <Program> >();
                    logger?.LogError(ex, "An error occured while seeding the database");
                }
            }
            host.Run();
        }
Esempio n. 2
0
 public static void Initialize(EventProjectDbContext dbContext)
 {
     ProfileDbTableInitializer.Initialize(dbContext);
     EventDbTableInitializer.Initialize(dbContext);
     EventProfileDbTableInitializer.Initialize(dbContext);
 }
Esempio n. 3
0
 protected override void initializeDatabase(EventProjectDbContext context)
 {
     EventDbTableInitializer.Initialize(context);
 }