Exemplo n.º 1
0
 void Write4_Category(string n, string ns, global::Catalog.Category o, bool isNullable, bool needType)
 {
     if ((object)o == null)
     {
         if (isNullable)
         {
             WriteNullTagLiteral(n, ns);
         }
         return;
     }
     if (!needType)
     {
         System.Type t = o.GetType();
         if (t == typeof(global::Catalog.Category))
         {
         }
         else
         {
             throw CreateUnknownTypeException(o);
         }
     }
     WriteStartElement(n, ns, o, false, null);
     if (needType)
     {
         WriteXsiType(@"Category", @"");
     }
     WriteElementString(@"Description", @"", ((global::System.String)o.@Description));
     WriteElementStringRaw(@"Id", @"", System.Xml.XmlConvert.ToString((global::System.Int32)((global::System.Int32)o.@Id)));
     WriteElementString(@"Name", @"", ((global::System.String)o.@Name));
     {
         global::System.Collections.Generic.List <global::Catalog.Products> a = (global::System.Collections.Generic.List <global::Catalog.Products>)((global::System.Collections.Generic.List <global::Catalog.Products>)o.@Products);
         if (a != null)
         {
             WriteStartElement(@"Products", @"", null, false);
             for (int ia = 0; ia < ((System.Collections.ICollection)a).Count; ia++)
             {
                 Write3_Products(@"Products", @"", ((global::Catalog.Products)a[ia]), true, false);
             }
             WriteEndElement();
         }
     }
     WriteEndElement(o);
 }
Exemplo n.º 2
0
        global::Catalog.Category Read4_Category(bool isNullable, bool checkType)
        {
            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_Category && (object)((System.Xml.XmlQualifiedName)xsiType).Namespace == (object)id2_Item))
                {
                }
                else
                {
                    throw CreateUnknownTypeException((System.Xml.XmlQualifiedName)xsiType);
                }
            }
            if (isNull)
            {
                return(null);
            }
            global::Catalog.Category o;
            o = new global::Catalog.Category();
            if ((object)(o.@Products) == null)
            {
                o.@Products = new global::System.Collections.Generic.List <global::Catalog.Products>();
            }
            global::System.Collections.Generic.List <global::Catalog.Products> a_3 = (global::System.Collections.Generic.List <global::Catalog.Products>)o.@Products;
            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 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)
                {
                    do
                    {
                        if (!paramsRead[0] && ((object)Reader.LocalName == (object)id9_Description && (object)Reader.NamespaceURI == (object)id2_Item))
                        {
                            {
                                o.@Description = Reader.ReadElementString();
                            }
                            paramsRead[0] = true;
                            break;
                        }
                        if (!paramsRead[1] && ((object)Reader.LocalName == (object)id5_Id && (object)Reader.NamespaceURI == (object)id2_Item))
                        {
                            {
                                o.@Id = System.Xml.XmlConvert.ToInt32(Reader.ReadElementString());
                            }
                            paramsRead[1] = true;
                            break;
                        }
                        if (!paramsRead[2] && ((object)Reader.LocalName == (object)id7_Name && (object)Reader.NamespaceURI == (object)id2_Item))
                        {
                            {
                                o.@Name = Reader.ReadElementString();
                            }
                            paramsRead[2] = true;
                            break;
                        }
                        if (((object)Reader.LocalName == (object)id4_Products && (object)Reader.NamespaceURI == (object)id2_Item))
                        {
                            if (!ReadNull())
                            {
                                if ((object)(o.@Products) == null)
                                {
                                    o.@Products = new global::System.Collections.Generic.List <global::Catalog.Products>();
                                }
                                global::System.Collections.Generic.List <global::Catalog.Products> a_3_0 = (global::System.Collections.Generic.List <global::Catalog.Products>)o.@Products;
                                if ((Reader.IsEmptyElement))
                                {
                                    Reader.Skip();
                                }
                                else
                                {
                                    Reader.ReadStartElement();
                                    Reader.MoveToContent();
                                    int whileIterations2 = 0;
                                    int readerCount2     = ReaderCount;
                                    while (Reader.NodeType != System.Xml.XmlNodeType.EndElement && Reader.NodeType != System.Xml.XmlNodeType.None)
                                    {
                                        if (Reader.NodeType == System.Xml.XmlNodeType.Element)
                                        {
                                            do
                                            {
                                                if (((object)Reader.LocalName == (object)id4_Products && (object)Reader.NamespaceURI == (object)id2_Item))
                                                {
                                                    if ((object)(a_3_0) == null)
                                                    {
                                                        Reader.Skip();
                                                    }
                                                    else
                                                    {
                                                        a_3_0.Add(Read3_Products(true, true));
                                                    }
                                                    break;
                                                }
                                                UnknownNode(null, @":Products");
                                            } while (false);
                                        }
                                        else
                                        {
                                            UnknownNode(null, @":Products");
                                        }
                                        Reader.MoveToContent();
                                        CheckReaderCount(ref whileIterations2, ref readerCount2);
                                    }
                                    ReadEndElement();
                                }
                            }
                            break;
                        }
                        UnknownNode((object)o, @":Description, :Id, :Name, :Products");
                    } while (false);
                }
                else
                {
                    UnknownNode((object)o, @":Description, :Id, :Name, :Products");
                }
                Reader.MoveToContent();
                CheckReaderCount(ref whileIterations1, ref readerCount1);
            }
            ReadEndElement();
            return(o);
        }