public object Clone() { SourceCollection sources = new SourceCollection(null); foreach (Source source in this) { sources.Add((Source) source.Clone()); } return sources; }
internal void ConvertTableTypeTo(System.Data.Design.TableType newTableType) { if (newTableType != this.tableType) { IComponentChangeService service = (IComponentChangeService) this.GetService(typeof(IComponentChangeService)); if (service != null) { service.OnComponentChanging(this, null); } try { this.TableType = newTableType; this.mainSource = null; this.sources = null; this.mappings = null; this.provider = string.Empty; this.OnTableTypeChanged(); } finally { if (service != null) { service.OnComponentChanged(this, null, null, null); } } } }
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(); }