예제 #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 <IdentityContext>().CreateDbContext())
     {
         if (_hostingEnvironment.IsDevelopment())
         {
             var migrationInitializer = new IdentityContextInitializerDropCreate(dbContext);
             migrationInitializer.Initialize();
         }
         else
         {
             var migrationInitializer = new IdentityContextInitializerMigrate(dbContext);
             migrationInitializer.Initialize();
         }
     }
 }