public Named ( string name ) : |
||
name | string | |
return |
public void Merge(XElement source, ContentTypeDefinitionBuilder builder) { builder.Named(XmlConvert.DecodeName(source.Name.LocalName)); foreach (var setting in _settingsReader.Map(source)) { builder.WithSetting(setting.Key, setting.Value); } foreach (var iter in source.Elements()) { var partElement = iter; var partName = XmlConvert.DecodeName(partElement.Name.LocalName); if (partName == "remove") { var nameAttribute = partElement.Attribute("name"); if (nameAttribute != null) { builder.RemovePart(nameAttribute.Value); } } else { builder.WithPart( partName, partBuilder => { foreach (var setting in _settingsReader.Map(partElement)) { partBuilder.WithSetting(setting.Key, setting.Value); } }); } } }
/// <summary> /// Merges a given content type definition provided in a XML format into a content type definition builder. /// </summary> /// <param name="element">The XML content type definition.</param> /// <param name="contentTypeDefinitionBuilder">The content type definition builder.</param> public void Merge(XElement element, ContentTypeDefinitionBuilder contentTypeDefinitionBuilder) { Argument.ThrowIfNull(element, "element"); Argument.ThrowIfNull(contentTypeDefinitionBuilder, "contentTypeDefinitionBuilder"); // Merge name contentTypeDefinitionBuilder.Named(XmlConvert.DecodeName(element.Name.LocalName)); // Merge settings foreach (var setting in _settingsFormatter.Map(element)) { contentTypeDefinitionBuilder.WithSetting(setting.Key, setting.Value); } // Merge parts foreach (var iter in element.Elements()) { var partElement = iter; var partName = XmlConvert.DecodeName(partElement.Name.LocalName); if (partName == "remove") { var nameAttribute = partElement.Attribute("name"); if (nameAttribute != null) { contentTypeDefinitionBuilder.RemovePart(nameAttribute.Value); } } else { contentTypeDefinitionBuilder.WithPart( partName, partBuilder => { foreach (var setting in _settingsFormatter.Map(partElement)) { partBuilder.WithSetting(setting.Key, setting.Value); } }); } } }