public void Migrate(MigrationInfo migrationInfo) { if (migrationInfo == null) { throw new ArgumentNullException("migrationInfo"); } EnsureTargetCategory(migrationInfo.TargetCategoryName); EnsureFields(migrationInfo.TargetCategoryName, migrationInfo.AllFields); MigratePostsAndFieldValues(migrationInfo.SourceCategoryName, migrationInfo.TargetCategoryName, migrationInfo.ChangedFieldNames); // Delete old fields (names are the ChangedFieldNames.Keys collection). string[] fieldsToDelete = new string[migrationInfo.ChangedFieldNames.Keys.Count]; migrationInfo.ChangedFieldNames.Keys.CopyTo(fieldsToDelete, 0); DeleteFields(migrationInfo.TargetCategoryName, fieldsToDelete); if (!String.Equals(migrationInfo.SourceCategoryName, migrationInfo.TargetCategoryName)) { DeleteCategory(migrationInfo.SourceCategoryName); } }
public void Migrate(MigrationInfo migrationInfo) { if (migrationInfo == null) { throw new ArgumentNullException("migrationInfo"); } EnsureTargetCategory(migrationInfo.TargetCategoryName); EnsureFields(migrationInfo.TargetCategoryName, migrationInfo.AllFields); MigratePostsAndFieldValues(migrationInfo.SourceCategoryName, migrationInfo.TargetCategoryName, migrationInfo.ChangedFieldNames); // Delete old fields (names are the ChangedFieldNames.Keys collection). string[] fieldsToDelete = new string[migrationInfo.ChangedFieldNames.Keys.Count]; migrationInfo.ChangedFieldNames.Keys.CopyTo(fieldsToDelete, 0); DeleteFields(migrationInfo.TargetCategoryName, fieldsToDelete); if (!String.Equals(migrationInfo.SourceCategoryName, migrationInfo.TargetCategoryName)) { DeleteCategory(migrationInfo.SourceCategoryName); } }