示例#1
0
        void Write2_Todo(string n, string ns, global::TodoListApp.Todo 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::TodoListApp.Todo))
                {
                }
                else
                {
                    throw CreateUnknownTypeException(o);
                }
            }
            WriteStartElement(n, ns, o, false, null);
            if (needType)
            {
                WriteXsiType(@"Todo", defaultNamespace);
            }
            string namespace3 = (parentCompileTimeNs == @"" && parentRuntimeNs != null) ? parentRuntimeNs : @"";

            WriteElementString(@"_UID", namespace3, ((global::System.String)o.@_UID));
            string namespace4 = (parentCompileTimeNs == @"" && parentRuntimeNs != null) ? parentRuntimeNs : @"";

            WriteElementString(@"_Title", namespace4, ((global::System.String)o.@_Title));
            string namespace5 = (parentCompileTimeNs == @"" && parentRuntimeNs != null) ? parentRuntimeNs : @"";

            WriteElementString(@"_Description", namespace5, ((global::System.String)o.@_Description));
            string namespace6 = (parentCompileTimeNs == @"" && parentRuntimeNs != null) ? parentRuntimeNs : @"";

            WriteElementStringRaw(@"_isDone", namespace6, System.Xml.XmlConvert.ToString((global::System.Boolean)((global::System.Boolean)o.@_isDone)));
            string namespace7 = (parentCompileTimeNs == @"" && parentRuntimeNs != null) ? parentRuntimeNs : @"";

            WriteElementString(@"UID", namespace7, ((global::System.String)o.@UID));
            string namespace8 = (parentCompileTimeNs == @"" && parentRuntimeNs != null) ? parentRuntimeNs : @"";

            WriteElementString(@"Title", namespace8, ((global::System.String)o.@Title));
            string namespace9 = (parentCompileTimeNs == @"" && parentRuntimeNs != null) ? parentRuntimeNs : @"";

            WriteElementString(@"Description", namespace9, ((global::System.String)o.@Description));
            string namespace10 = (parentCompileTimeNs == @"" && parentRuntimeNs != null) ? parentRuntimeNs : @"";

            WriteElementStringRaw(@"isDone", namespace10, System.Xml.XmlConvert.ToString((global::System.Boolean)((global::System.Boolean)o.@isDone)));
            WriteEndElement(o);
        }
示例#2
0
        global::TodoListApp.Todo Read2_Todo(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_Todo && string.Equals(((System.Xml.XmlQualifiedName)xsiType).Namespace, defaultNamespace ?? id2_Item)))
                {
                }
                else
                {
                    throw CreateUnknownTypeException((System.Xml.XmlQualifiedName)xsiType);
                }
            }
            if (isNull)
            {
                return(null);
            }
            global::TodoListApp.Todo o;
            o = new global::TodoListApp.Todo();
            bool[] paramsRead = new bool[8];
            while (Reader.MoveToNextAttribute())
            {
                if (!IsXmlnsAttribute(Reader.Name))
                {
                    UnknownNode((object)o);
                }
            }
            Reader.MoveToElement();
            if (Reader.IsEmptyElement)
            {
                Reader.Skip();
                return(o);
            }
            Reader.ReadStartElement();
            Reader.MoveToContent();
            int whileIterations1 = 0;
            int readerCount1     = 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)id4__UID && string.Equals(Reader.NamespaceURI, defaultNamespace ?? id2_Item)))
                    {
                        {
                            o.@_UID = Reader.ReadElementContentAsString();
                        }
                        paramsRead[0] = true;
                    }
                    else if (!paramsRead[1] && ((object)Reader.LocalName == (object)id5__Title && string.Equals(Reader.NamespaceURI, defaultNamespace ?? id2_Item)))
                    {
                        {
                            o.@_Title = Reader.ReadElementContentAsString();
                        }
                        paramsRead[1] = true;
                    }
                    else if (!paramsRead[2] && ((object)Reader.LocalName == (object)id6__Description && string.Equals(Reader.NamespaceURI, defaultNamespace ?? id2_Item)))
                    {
                        {
                            o.@_Description = Reader.ReadElementContentAsString();
                        }
                        paramsRead[2] = true;
                    }
                    else if (!paramsRead[3] && ((object)Reader.LocalName == (object)id7__isDone && string.Equals(Reader.NamespaceURI, defaultNamespace ?? id2_Item)))
                    {
                        {
                            o.@_isDone = System.Xml.XmlConvert.ToBoolean(Reader.ReadElementContentAsString());
                        }
                        paramsRead[3] = true;
                    }
                    else if (!paramsRead[4] && ((object)Reader.LocalName == (object)id8_UID && string.Equals(Reader.NamespaceURI, defaultNamespace ?? id2_Item)))
                    {
                        {
                            o.@UID = Reader.ReadElementContentAsString();
                        }
                        paramsRead[4] = true;
                    }
                    else if (!paramsRead[5] && ((object)Reader.LocalName == (object)id9_Title && string.Equals(Reader.NamespaceURI, defaultNamespace ?? id2_Item)))
                    {
                        {
                            o.@Title = Reader.ReadElementContentAsString();
                        }
                        paramsRead[5] = true;
                    }
                    else if (!paramsRead[6] && ((object)Reader.LocalName == (object)id10_Description && string.Equals(Reader.NamespaceURI, defaultNamespace ?? id2_Item)))
                    {
                        {
                            o.@Description = Reader.ReadElementContentAsString();
                        }
                        paramsRead[6] = true;
                    }
                    else if (!paramsRead[7] && ((object)Reader.LocalName == (object)id11_isDone && string.Equals(Reader.NamespaceURI, defaultNamespace ?? id2_Item)))
                    {
                        {
                            o.@isDone = System.Xml.XmlConvert.ToBoolean(Reader.ReadElementContentAsString());
                        }
                        paramsRead[7] = true;
                    }
                    else
                    {
                        UnknownNode((object)o, @":_UID, :_Title, :_Description, :_isDone, :UID, :Title, :Description, :isDone");
                    }
                }
                else
                {
                    UnknownNode((object)o, @":_UID, :_Title, :_Description, :_isDone, :UID, :Title, :Description, :isDone");
                }
                Reader.MoveToContent();
                CheckReaderCount(ref whileIterations1, ref readerCount1);
            }
            ReadEndElement();
            return(o);
        }