private static void WriteAddOrRemovePropertyTypes(ContentListType origSet, ContentListType newSet, List <PropertySet> modifiedPropertySets, SchemaWriter writer) { bool origSetChanged = false; if (origSet == null) { //-- New NodeType: add all property foreach (PropertyType propType in newSet.PropertyTypes) { writer.AddPropertyTypeToPropertySet(propType, newSet, true); } return; } //-- Delete PropertyType if needed foreach (PropertyType propType in GetTypesToDelete <PropertyType>(origSet.PropertyTypes, newSet.PropertyTypes)) { writer.RemovePropertyTypeFromPropertySet(propType, newSet); origSetChanged = true; } //-- Create or modify PropertyTypes foreach (PropertyType propType in newSet.PropertyTypes) { if (NeedToCreate <PropertyType>(origSet.PropertyTypes, propType)) { writer.AddPropertyTypeToPropertySet(propType, newSet, true); origSetChanged = true; } } if (origSetChanged && !modifiedPropertySets.Contains(origSet)) { modifiedPropertySets.Add(origSet); } }
private ContentListType CreateContentListType(int id, string name) { var listType = new ContentListType(id, name, this); this.ContentListTypes.Add(listType); return(listType); }
private static void WriteDeleteContentListType(SchemaWriter writer, ContentListType contentListType, SchemaEditor origSchema, List <PropertySet> modifiedPropertySets) { writer.DeleteContentListType(contentListType); if (!modifiedPropertySets.Contains(contentListType)) { modifiedPropertySets.Add(contentListType); } }
public void DeleteContentListType(ContentListType listType) { if (listType == null) { throw new ArgumentNullException("listType"); } if (listType.SchemaRoot != this) { throw new SchemaEditorCommandException(SR.Exceptions.Schema.Msg_InconsistentHierarchy); } listType.PropertyTypes.Clear(); this.ContentListTypes.Remove(listType); }
private static void ContentListTypeToXml(ContentListType lt, StringBuilder sb, string indent) { // <NodeType itemID="1" name="NodeType1"> sb.Append(indent).Append("<ContentListType"); sb.Append(" itemID=\"").Append(lt.Id).Append("\""); sb.Append(" name=\"").Append(lt.Name).Append("\""); if (lt.PropertyTypes.Count == 0) { sb.AppendLine(" />"); return; } sb.AppendLine(">"); foreach (PropertyType pt in lt.PropertyTypes) { PropertyTypeReferenceToXml(pt, sb, indent + "\t"); } sb.Append(indent).AppendLine("</ContentListType>"); }
public abstract void DeleteContentListType(ContentListType contentListType);