public XElement MigrateContent(XElement content, int fromVersion, int toVersion) { IMigrationSegment<XElement> migrationSegment = ValidMigrations.FirstOrDefault(x => x.FromVersion == fromVersion && x.ToVersion == toVersion); if(migrationSegment == null) { throw new InvalidOperationException("Cannot migrate content from version " + fromVersion + " to version " + toVersion); } content = migrationSegment.Execute(content); return content; }
private MigrationPath _BuildMigrationPathUsingSequentialVersions(IContentMigrator migrator, int fromVersion, int toVersion) { MigrationPath migrationPath = new MigrationPath(); while (fromVersion != toVersion) { IMigrationSegment segment = _FindExactMigration(migrator, fromVersion, fromVersion + 1); if (segment == null) { return(null); } migrationPath.Add(segment); fromVersion++; } return(migrationPath); }
public bool Equals(IMigrationSegment <T> other) { return(Equals((IMigrationSegment)other)); }
public bool Equals(IMigrationSegment other) { return(other.FromVersion == FromVersion && other.ToVersion == ToVersion); }
public EmptyMigrator() { ValidMigrations = new IMigrationSegment <T>[] {}; }