public static FindMigrations ( |
||
assembly | ||
리턴 | List |
public static List<MigrationInfo> FindMigrations(Assembly assembly)
{
return assembly.GetTypes()
.Where(p => p.IsSubclassOf(typeof(Migration)) && !p.IsAbstract)
.Select(x => new MigrationInfo(x))
.OrderBy(x => x.Version)
.ToList();
}
public void Run(long targetVersion) { List <MigrationInfo> migrationsFromAssembly = MigrationFinder.FindMigrations(_targetAssembly); VersionRepository.EnsureSchemaVersionTable(migrationsFromAssembly); List <long> migrationsFromDatabase = VersionRepository.GetAppliedMigrations(); var migrationPlan = new MigrationPlan(migrationsFromDatabase, migrationsFromAssembly, targetVersion); RunMigrations(migrationPlan); }