void IXmlSerializable.ReadXml(XmlReader reader) { Debug.Print("Calling IXmlSerializable.ReadXml(XmlReader reader)"); if (reader is XmlModelParser modelReader) { modelReader.WhitespaceHandling = WhitespaceHandling.None; switch (this) { case Model model: { Model other = modelReader.ParseModel(); break; } case Element element: { Element other = modelReader.ParseElement(); element.Name = other.Name; element.Children = other.Children; break; } case Relationship relationship: { Relationship other = modelReader.ParseRelationship(); relationship.Name = other.Name; relationship.ReturnType = other.ReturnType; relationship.ReturnTypeNamespace = other.ReturnTypeNamespace; relationship.Specialize = other.Specialize; relationship.AdaptInstance = other.AdaptInstance; relationship.UnresolvedReturnType = other.UnresolvedReturnType; break; } case Property property: { Property other = modelReader.ParseProperty(); property.Name = other.Name; property.OverrideName = other.OverrideName; break; } case Implements implements: { Implements other = modelReader.ParseImplements(); implements.Name = other.Name; break; } } } }
public Implements ParseImplements() { Implements i = new Implements(); Read(); XElement x = (XElement)XNode.ReadFrom(this); i.Name = x.Attribute("Name")?.Value ?? string.Empty; return(i); }