void Write2_PersistModel(string n, string ns, global::NavigationMenuSample.Models.PersistModel o, bool isNullable, bool needType, string parentRuntimeNs = null, string parentCompileTimeNs = null) { string defaultNamespace = parentRuntimeNs; if ((object)o == null) { if (isNullable) { WriteNullTagLiteral(n, ns); } return; } if (!needType) { System.Type t = o.GetType(); if (t == typeof(global::NavigationMenuSample.Models.PersistModel)) { } else { throw CreateUnknownTypeException(o); } } WriteStartElement(n, ns, o, false, null); if (needType) { WriteXsiType(@"PersistModel", defaultNamespace); } string namespace6 = (parentCompileTimeNs == @"" && parentRuntimeNs != null) ? parentRuntimeNs : @""; WriteElementString(@"UserID", namespace6, ((global::System.String)o.@UserID)); string namespace7 = (parentCompileTimeNs == @"" && parentRuntimeNs != null) ? parentRuntimeNs : @""; WriteElementString(@"ScreenName", namespace7, ((global::System.String)o.@ScreenName)); string namespace8 = (parentCompileTimeNs == @"" && parentRuntimeNs != null) ? parentRuntimeNs : @""; WriteElementString(@"AccessToken", namespace8, ((global::System.String)o.@AccessToken)); string namespace9 = (parentCompileTimeNs == @"" && parentRuntimeNs != null) ? parentRuntimeNs : @""; WriteElementString(@"AccessSecretToken", namespace9, ((global::System.String)o.@AccessSecretToken)); WriteEndElement(o); }
global::NavigationMenuSample.Models.PersistModel Read2_PersistModel(bool isNullable, bool checkType, string defaultNamespace = null) { System.Xml.XmlQualifiedName xsiType = checkType ? GetXsiType() : null; bool isNull = false; if (isNullable) { isNull = ReadNull(); } if (checkType) { if (xsiType == null || ((object)((System.Xml.XmlQualifiedName)xsiType).Name == (object)id3_PersistModel && string.Equals(((System.Xml.XmlQualifiedName)xsiType).Namespace, defaultNamespace ?? id2_Item))) { } else { throw CreateUnknownTypeException((System.Xml.XmlQualifiedName)xsiType); } } if (isNull) { return(null); } global::NavigationMenuSample.Models.PersistModel o; o = new global::NavigationMenuSample.Models.PersistModel(); bool[] paramsRead = new bool[4]; while (Reader.MoveToNextAttribute()) { if (!IsXmlnsAttribute(Reader.Name)) { UnknownNode((object)o); } } Reader.MoveToElement(); if (Reader.IsEmptyElement) { Reader.Skip(); return(o); } Reader.ReadStartElement(); Reader.MoveToContent(); int whileIterations3 = 0; int readerCount3 = ReaderCount; while (Reader.NodeType != System.Xml.XmlNodeType.EndElement && Reader.NodeType != System.Xml.XmlNodeType.None) { if (Reader.NodeType == System.Xml.XmlNodeType.Element) { if (!paramsRead[0] && ((object)Reader.LocalName == (object)id5_UserID && string.Equals(Reader.NamespaceURI, defaultNamespace ?? id2_Item))) { { o.@UserID = Reader.ReadElementContentAsString(); } paramsRead[0] = true; } else if (!paramsRead[1] && ((object)Reader.LocalName == (object)id6_ScreenName && string.Equals(Reader.NamespaceURI, defaultNamespace ?? id2_Item))) { { o.@ScreenName = Reader.ReadElementContentAsString(); } paramsRead[1] = true; } else if (!paramsRead[2] && ((object)Reader.LocalName == (object)id7_AccessToken && string.Equals(Reader.NamespaceURI, defaultNamespace ?? id2_Item))) { { o.@AccessToken = Reader.ReadElementContentAsString(); } paramsRead[2] = true; } else if (!paramsRead[3] && ((object)Reader.LocalName == (object)id8_AccessSecretToken && string.Equals(Reader.NamespaceURI, defaultNamespace ?? id2_Item))) { { o.@AccessSecretToken = Reader.ReadElementContentAsString(); } paramsRead[3] = true; } else { UnknownNode((object)o, @":UserID, :ScreenName, :AccessToken, :AccessSecretToken"); } } else { UnknownNode((object)o, @":UserID, :ScreenName, :AccessToken, :AccessSecretToken"); } Reader.MoveToContent(); CheckReaderCount(ref whileIterations3, ref readerCount3); } ReadEndElement(); return(o); }
global::NavigationMenuSample.Models.PersistModel Read2_PersistModel(bool isNullable, bool checkType, string defaultNamespace = null) { System.Xml.XmlQualifiedName xsiType = checkType ? GetXsiType() : null; bool isNull = false; if (isNullable) isNull = ReadNull(); if (checkType) { if (xsiType == null || ((object) ((System.Xml.XmlQualifiedName)xsiType).Name == (object)id3_PersistModel && string.Equals( ((System.Xml.XmlQualifiedName)xsiType).Namespace, defaultNamespace ?? id2_Item))) { } else throw CreateUnknownTypeException((System.Xml.XmlQualifiedName)xsiType); } if (isNull) return null; global::NavigationMenuSample.Models.PersistModel o; o = new global::NavigationMenuSample.Models.PersistModel(); bool[] paramsRead = new bool[4]; while (Reader.MoveToNextAttribute()) { if (!IsXmlnsAttribute(Reader.Name)) { UnknownNode((object)o); } } Reader.MoveToElement(); if (Reader.IsEmptyElement) { Reader.Skip(); return o; } Reader.ReadStartElement(); Reader.MoveToContent(); int whileIterations3 = 0; int readerCount3 = ReaderCount; while (Reader.NodeType != System.Xml.XmlNodeType.EndElement && Reader.NodeType != System.Xml.XmlNodeType.None) { if (Reader.NodeType == System.Xml.XmlNodeType.Element) { if (!paramsRead[0] && ((object) Reader.LocalName == (object)id5_UserID && string.Equals(Reader.NamespaceURI, defaultNamespace ?? id2_Item))) { { o.@UserID = Reader.ReadElementContentAsString(); } paramsRead[0] = true; } else if (!paramsRead[1] && ((object) Reader.LocalName == (object)id6_ScreenName && string.Equals(Reader.NamespaceURI, defaultNamespace ?? id2_Item))) { { o.@ScreenName = Reader.ReadElementContentAsString(); } paramsRead[1] = true; } else if (!paramsRead[2] && ((object) Reader.LocalName == (object)id7_AccessToken && string.Equals(Reader.NamespaceURI, defaultNamespace ?? id2_Item))) { { o.@AccessToken = Reader.ReadElementContentAsString(); } paramsRead[2] = true; } else if (!paramsRead[3] && ((object) Reader.LocalName == (object)id8_AccessSecretToken && string.Equals(Reader.NamespaceURI, defaultNamespace ?? id2_Item))) { { o.@AccessSecretToken = Reader.ReadElementContentAsString(); } paramsRead[3] = true; } else { UnknownNode((object)o, @":UserID, :ScreenName, :AccessToken, :AccessSecretToken"); } } else { UnknownNode((object)o, @":UserID, :ScreenName, :AccessToken, :AccessSecretToken"); } Reader.MoveToContent(); CheckReaderCount(ref whileIterations3, ref readerCount3); } ReadEndElement(); return o; }