コード例 #1
0
 private void ReadXmlSchema(DataSourceXmlTextReader xmlReader)
 {
     this.designConnections = new DesignConnectionCollection(this);
     this.designTables      = new DesignTableCollection(this);
     this.designRelations   = new DesignRelationCollection(this);
     this.sources           = new SourceCollection(this);
     this.serializer        = new DataSourceXmlSerializer();
     this.dataSet           = new System.Data.DataSet();
     this.dataSet.Locale    = CultureInfo.InvariantCulture;
     System.Data.DataSet set = new System.Data.DataSet {
         Locale = CultureInfo.InvariantCulture
     };
     set.ReadXmlSchema(xmlReader);
     this.dataSet = set;
     foreach (DataTable table in this.dataSet.Tables)
     {
         DesignTable table2 = this.designTables[table.TableName];
         if (table2 == null)
         {
             this.designTables.Add(new DesignTable(table, TableType.DataTable));
         }
         else
         {
             table2.DataTable = table;
         }
         foreach (Constraint constraint in table.Constraints)
         {
             ForeignKeyConstraint foreignKeyConstraint = constraint as ForeignKeyConstraint;
             if (foreignKeyConstraint != null)
             {
                 this.designRelations.Add(new DesignRelation(foreignKeyConstraint));
             }
         }
     }
     foreach (DataRelation relation in this.dataSet.Relations)
     {
         DesignRelation relation2 = this.designRelations[relation.ChildKeyConstraint];
         if (relation2 != null)
         {
             relation2.DataRelation = relation;
         }
         else
         {
             this.designRelations.Add(new DesignRelation(relation));
         }
     }
     foreach (Source source in this.Sources)
     {
         this.SetConnectionProperty(source);
     }
     foreach (DesignTable table3 in this.DesignTables)
     {
         this.SetConnectionProperty(table3.MainSource);
         foreach (Source source2 in table3.Sources)
         {
             this.SetConnectionProperty(source2);
         }
     }
     this.serializer.InitializeObjects();
 }
コード例 #2
0
 void IDataSourceXmlSpecialOwner.WriteSpecialItem(string propertyName, XmlWriter writer, DataSourceXmlSerializer serializer)
 {
     if (propertyName == "ConnectionStringObject")
     {
         writer.WriteString(this.ConnectionStringObject.ToFullString());
     }
     else if (propertyName == "PropertyReference")
     {
         writer.WriteString(PropertyReferenceSerializer.Serialize(this.PropertyReference));
     }
 }
コード例 #3
0
 void IDataSourceXmlSpecialOwner.ReadSpecialItem(string propertyName, XmlNode xmlNode, DataSourceXmlSerializer serializer)
 {
     if (propertyName == "ConnectionStringObject")
     {
         this.connectionStringValue = xmlNode.InnerText;
     }
     else if (propertyName == "PropertyReference")
     {
         this.propertyReference = PropertyReferenceSerializer.Deserialize(xmlNode.InnerText);
     }
 }
 void IDataSourceXmlSpecialOwner.ReadSpecialItem(string propertyName, XmlNode xmlNode, DataSourceXmlSerializer serializer)
 {
     if (propertyName == "ConnectionStringObject")
     {
         this.connectionStringValue = xmlNode.InnerText;
     }
     else if (propertyName == "PropertyReference")
     {
         this.propertyReference = PropertyReferenceSerializer.Deserialize(xmlNode.InnerText);
     }
 }
 void IDataSourceXmlSpecialOwner.WriteSpecialItem(string propertyName, XmlWriter writer, DataSourceXmlSerializer serializer)
 {
     if (propertyName == "ConnectionStringObject")
     {
         writer.WriteString(this.ConnectionStringObject.ToFullString());
     }
     else if (propertyName == "PropertyReference")
     {
         writer.WriteString(PropertyReferenceSerializer.Serialize(this.PropertyReference));
     }
 }
コード例 #6
0
 void IDataSourceXmlSpecialOwner.WriteSpecialItem(string propertyName, XmlWriter writer, DataSourceXmlSerializer serializer)
 {
     if (propertyName.Equals("ScalarCallRetval"))
     {
         writer.WriteString(this.scalarCallRetval.AssemblyQualifiedName);
     }
 }
コード例 #7
0
 void IDataSourceXmlSpecialOwner.ReadSpecialItem(string propertyName, XmlNode xmlNode, DataSourceXmlSerializer serializer)
 {
     if (propertyName.Equals("ScalarCallRetval"))
     {
         this.scalarCallRetval = typeof(object);
         if (StringUtil.NotEmptyAfterTrim(xmlNode.InnerText))
         {
             this.scalarCallRetval = Type.GetType(xmlNode.InnerText, false);
         }
     }
 }
コード例 #8
0
 void IDataSourceXmlSpecialOwner.WriteSpecialItem(string propertyName, XmlWriter writer, DataSourceXmlSerializer serializer)
 {
     if (propertyName.Equals("ScalarCallRetval"))
     {
         writer.WriteString(this.scalarCallRetval.AssemblyQualifiedName);
     }
 }
コード例 #9
0
 void IDataSourceXmlSpecialOwner.ReadSpecialItem(string propertyName, XmlNode xmlNode, DataSourceXmlSerializer serializer)
 {
     if (propertyName.Equals("ScalarCallRetval"))
     {
         this.scalarCallRetval = typeof(object);
         if (StringUtil.NotEmptyAfterTrim(xmlNode.InnerText))
         {
             this.scalarCallRetval = Type.GetType(xmlNode.InnerText, false);
         }
     }
 }
コード例 #10
0
 void IDataSourceXmlSpecialOwner.WriteSpecialItem(string propertyName, XmlWriter writer, DataSourceXmlSerializer serializer)
 {
     if (propertyName == "Mappings")
     {
         foreach (DataColumnMapping mapping in this.Mappings)
         {
             writer.WriteStartElement(string.Empty, "Mapping", "urn:schemas-microsoft-com:xml-msdatasource");
             writer.WriteAttributeString("SourceColumn", mapping.SourceColumn);
             writer.WriteAttributeString("DataSetColumn", mapping.DataSetColumn);
             writer.WriteEndElement();
         }
     }
 }
コード例 #11
0
 void IDataSourceXmlSpecialOwner.ReadSpecialItem(string propertyName, XmlNode xmlNode, DataSourceXmlSerializer serializer)
 {
     if (propertyName == "Mappings")
     {
         string sourceColumn = string.Empty;
         string dataSetColumn = string.Empty;
         XmlElement element = xmlNode as XmlElement;
         if (element != null)
         {
             foreach (XmlNode node in element.ChildNodes)
             {
                 XmlElement element2 = node as XmlElement;
                 if ((element2 != null) && (element2.LocalName == "Mapping"))
                 {
                     XmlAttribute attribute = element2.Attributes["SourceColumn"];
                     if (attribute != null)
                     {
                         sourceColumn = attribute.InnerText;
                     }
                     attribute = element2.Attributes["DataSetColumn"];
                     if (attribute != null)
                     {
                         dataSetColumn = attribute.InnerText;
                     }
                     DataColumnMapping mapping = new DataColumnMapping(sourceColumn, dataSetColumn);
                     this.Mappings.Add(mapping);
                 }
             }
         }
     }
 }
コード例 #12
0
        void IDataSourceXmlSerializable.WriteXml(XmlWriter xmlWriter, DataSourceXmlSerializer serializer)
        {
            switch (this.TableType)
            {
                case System.Data.Design.TableType.DataTable:
                    break;

                case System.Data.Design.TableType.RadTable:
                    xmlWriter.WriteStartElement(string.Empty, "TableAdapter", "urn:schemas-microsoft-com:xml-msdatasource");
                    serializer.SerializeBody(xmlWriter, this);
                    xmlWriter.WriteFullEndElement();
                    break;

                default:
                    return;
            }
        }
コード例 #13
0
 void IDataSourceXmlSerializable.ReadXml(XmlElement xmlElement, DataSourceXmlSerializer serializer)
 {
     if ((xmlElement.LocalName == "TableAdapter") || (xmlElement.LocalName == "DbTable"))
     {
         this.TableType = System.Data.Design.TableType.RadTable;
         serializer.DeserializeBody(xmlElement, this);
     }
 }
 private void ReadXmlSchema(DataSourceXmlTextReader xmlReader)
 {
     this.designConnections = new DesignConnectionCollection(this);
     this.designTables = new DesignTableCollection(this);
     this.designRelations = new DesignRelationCollection(this);
     this.sources = new SourceCollection(this);
     this.serializer = new DataSourceXmlSerializer();
     this.dataSet = new System.Data.DataSet();
     this.dataSet.Locale = CultureInfo.InvariantCulture;
     System.Data.DataSet set = new System.Data.DataSet {
         Locale = CultureInfo.InvariantCulture
     };
     set.ReadXmlSchema(xmlReader);
     this.dataSet = set;
     foreach (DataTable table in this.dataSet.Tables)
     {
         DesignTable table2 = this.designTables[table.TableName];
         if (table2 == null)
         {
             this.designTables.Add(new DesignTable(table, TableType.DataTable));
         }
         else
         {
             table2.DataTable = table;
         }
         foreach (Constraint constraint in table.Constraints)
         {
             ForeignKeyConstraint foreignKeyConstraint = constraint as ForeignKeyConstraint;
             if (foreignKeyConstraint != null)
             {
                 this.designRelations.Add(new DesignRelation(foreignKeyConstraint));
             }
         }
     }
     foreach (DataRelation relation in this.dataSet.Relations)
     {
         DesignRelation relation2 = this.designRelations[relation.ChildKeyConstraint];
         if (relation2 != null)
         {
             relation2.DataRelation = relation;
         }
         else
         {
             this.designRelations.Add(new DesignRelation(relation));
         }
     }
     foreach (Source source in this.Sources)
     {
         this.SetConnectionProperty(source);
     }
     foreach (DesignTable table3 in this.DesignTables)
     {
         this.SetConnectionProperty(table3.MainSource);
         foreach (Source source2 in table3.Sources)
         {
             this.SetConnectionProperty(source2);
         }
     }
     this.serializer.InitializeObjects();
 }