Esempio n. 1
0
        public override DataSet Clone()
        {
            RptData data = (RptData)base.Clone();

            data.InitVars();
            data.SchemaSerializationMode = this.SchemaSerializationMode;
            return(data);
        }
Esempio n. 2
0
        public static XmlSchemaComplexType GetTypedDataSetSchema(XmlSchemaSet xs)
        {
            RptData data = new RptData();
            XmlSchemaComplexType type     = new XmlSchemaComplexType();
            XmlSchemaSequence    sequence = new XmlSchemaSequence();
            XmlSchemaAny         item     = new XmlSchemaAny {
                Namespace = data.Namespace
            };

            sequence.Items.Add(item);
            type.Particle = sequence;
            XmlSchema schemaSerializable = data.GetSchemaSerializable();

            if (xs.Contains(schemaSerializable.TargetNamespace))
            {
                MemoryStream stream  = new MemoryStream();
                MemoryStream stream2 = new MemoryStream();
                try
                {
                    XmlSchema current = null;
                    schemaSerializable.Write(stream);
                    IEnumerator enumerator = xs.Schemas(schemaSerializable.TargetNamespace).GetEnumerator();
                    while (enumerator.MoveNext())
                    {
                        current = (XmlSchema)enumerator.Current;
                        stream2.SetLength(0L);
                        current.Write(stream2);
                        if (stream.Length == stream2.Length)
                        {
                            stream.Position  = 0L;
                            stream2.Position = 0L;
                            while ((stream.Position != stream.Length) && (stream.ReadByte() == stream2.ReadByte()))
                            {
                            }
                            if (stream.Position == stream.Length)
                            {
                                return(type);
                            }
                        }
                    }
                }
                finally
                {
                    if (stream != null)
                    {
                        stream.Close();
                    }
                    if (stream2 != null)
                    {
                        stream2.Close();
                    }
                }
            }
            xs.Add(schemaSerializable);
            return(type);
        }
Esempio n. 3
0
            public static XmlSchemaComplexType GetTypedTableSchema(XmlSchemaSet xs)
            {
                XmlSchemaComplexType type     = new XmlSchemaComplexType();
                XmlSchemaSequence    sequence = new XmlSchemaSequence();
                RptData      data             = new RptData();
                XmlSchemaAny item             = new XmlSchemaAny {
                    Namespace       = "http://www.w3.org/2001/XMLSchema",
                    MinOccurs       = 0M,
                    MaxOccurs       = 79228162514264337593543950335M,
                    ProcessContents = XmlSchemaContentProcessing.Lax
                };

                sequence.Items.Add(item);
                XmlSchemaAny any2 = new XmlSchemaAny {
                    Namespace       = "urn:schemas-microsoft-com:xml-diffgram-v1",
                    MinOccurs       = 1M,
                    ProcessContents = XmlSchemaContentProcessing.Lax
                };

                sequence.Items.Add(any2);
                XmlSchemaAttribute attribute = new XmlSchemaAttribute {
                    Name       = "namespace",
                    FixedValue = data.Namespace
                };

                type.Attributes.Add(attribute);
                XmlSchemaAttribute attribute2 = new XmlSchemaAttribute {
                    Name       = "tableTypeName",
                    FixedValue = "tbTaskDtlListDataTable"
                };

                type.Attributes.Add(attribute2);
                type.Particle = sequence;
                XmlSchema schemaSerializable = data.GetSchemaSerializable();

                if (xs.Contains(schemaSerializable.TargetNamespace))
                {
                    MemoryStream stream  = new MemoryStream();
                    MemoryStream stream2 = new MemoryStream();
                    try
                    {
                        XmlSchema current = null;
                        schemaSerializable.Write(stream);
                        IEnumerator enumerator = xs.Schemas(schemaSerializable.TargetNamespace).GetEnumerator();
                        while (enumerator.MoveNext())
                        {
                            current = (XmlSchema)enumerator.Current;
                            stream2.SetLength(0L);
                            current.Write(stream2);
                            if (stream.Length == stream2.Length)
                            {
                                stream.Position  = 0L;
                                stream2.Position = 0L;
                                while ((stream.Position != stream.Length) && (stream.ReadByte() == stream2.ReadByte()))
                                {
                                }
                                if (stream.Position == stream.Length)
                                {
                                    return(type);
                                }
                            }
                        }
                    }
                    finally
                    {
                        if (stream != null)
                        {
                            stream.Close();
                        }
                        if (stream2 != null)
                        {
                            stream2.Close();
                        }
                    }
                }
                xs.Add(schemaSerializable);
                return(type);
            }