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(); }
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)); } }
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.Equals("ScalarCallRetval")) { writer.WriteString(this.scalarCallRetval.AssemblyQualifiedName); } }
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); } } }
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(); } } }
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); } } } } }
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; } }
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); } }