public object ReadPropertyXml(PropertySerializerContext context, XmlNode propertyValue) { if (context.PropertyInfo.PropertyType != typeof(TableConfigurationCollection)) { return(null); } XPathNavigator navigator = propertyValue.CreateNavigator(); XmlNamespaceManager oManager = new XmlNamespaceManager(navigator.NameTable); TableConfigurationCollection collection = new TableConfigurationCollection(); TableConfigurationSerializer itemSerializer = new TableConfigurationSerializer(); // Add the CodeSmith namespace oManager.AddNamespace("cs", CodeSmithProject.DefaultNamespace); // Loop through items XPathNodeIterator oIterator = navigator.Select("cs:TableConfiguration", oManager); while (oIterator.MoveNext()) { collection.Add(itemSerializer.ReadPropertyXmlInner(context, ((IHasXmlNode)oIterator.Current).GetNode())); } return(collection); }
public void WritePropertyXml(PropertySerializerContext context, XmlWriter writer, object propertyValue) { TableConfigurationCollection collection = propertyValue as TableConfigurationCollection; if (collection != null) { TableConfigurationSerializer itemSerializer = new TableConfigurationSerializer(); foreach (TableConfiguration item in collection) { writer.WriteStartElement("TableConfiguration"); itemSerializer.WritePropertyXml(context, writer, item); writer.WriteEndElement(); } } }