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(); }
public void ReadXmlSchema(TextReader textReader, string baseURI) { DataSourceXmlTextReader xmlReader = new DataSourceXmlTextReader(this, textReader, baseURI); this.ReadXmlSchema(xmlReader); }
public void ReadXmlSchema(Stream stream, string baseURI) { DataSourceXmlTextReader xmlReader = new DataSourceXmlTextReader(this, stream, baseURI); this.ReadXmlSchema(xmlReader); }