コード例 #1
0
		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;
		}
コード例 #2
0
        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);
        }
コード例 #3
0
 public bool Equals(IMigrationSegment <T> other)
 {
     return(Equals((IMigrationSegment)other));
 }
コード例 #4
0
 public bool Equals(IMigrationSegment other)
 {
     return(other.FromVersion == FromVersion && other.ToVersion == ToVersion);
 }
コード例 #5
0
 public EmptyMigrator()
 {
     ValidMigrations = new IMigrationSegment <T>[] {};
 }