Ejemplo n.º 1
0
        public override void MigrateDatabaseAndSeed(string connectionString)
        {
            using (var context = TestHelper.GetContext <ApplicationContext>(connectionString, false))
            {
                var migration = new ApplicationContextInitializerMigrate(context);
                migration.Initialize();
            }

            using (var context = TestHelper.GetContext <IdentityContext>(connectionString, false))
            {
                var migration = new IdentityContextInitializerMigrate(context);
                migration.Initialize();
            }
        }
 public void Execute()
 {
     using (var dbContext = _dbContextFactory.GetFactory <ApplicationContext>().CreateDbContext())
     {
         if (_hostingEnvironment.IsDevelopment())
         {
             var migrationInitializer = new ApplicationContextInitializerDropCreate(dbContext);
             migrationInitializer.Initialize();
         }
         else
         {
             var migrationInitializer = new ApplicationContextInitializerMigrate(dbContext);
             migrationInitializer.Initialize();
         }
     }
 }