internal void ReadXmlSchema(XmlReader reader, bool denyResolving) { IntPtr ptr; Bid.ScopeEnter(out ptr, "<ds.DataTable.ReadXmlSchema|INFO> %d#, denyResolving=%d{bool}\n", this.ObjectID, denyResolving); try { System.Data.DataSet set = new System.Data.DataSet(); SerializationFormat remotingFormat = this.RemotingFormat; set.ReadXmlSchema(reader, denyResolving); string mainTableName = set.MainTableName; if (!ADP.IsEmpty(this.tableName) || !ADP.IsEmpty(mainTableName)) { DataTable currentTable = null; if (!ADP.IsEmpty(this.tableName)) { if (!ADP.IsEmpty(this.Namespace)) { currentTable = set.Tables[this.tableName, this.Namespace]; } else { int num3 = set.Tables.InternalIndexOf(this.tableName); if (num3 > -1) { currentTable = set.Tables[num3]; } } } else { string str3 = ""; int index = mainTableName.IndexOf(':'); if (index > -1) { str3 = mainTableName.Substring(0, index); } string str4 = mainTableName.Substring(index + 1, (mainTableName.Length - index) - 1); currentTable = set.Tables[str4, str3]; } if (currentTable == null) { string tableName = string.Empty; if (!ADP.IsEmpty(this.tableName)) { tableName = (this.Namespace.Length > 0) ? (this.Namespace + ":" + this.tableName) : this.tableName; } else { tableName = mainTableName; } throw ExceptionBuilder.TableNotFound(tableName); } currentTable._remotingFormat = remotingFormat; List<DataTable> tableList = new List<DataTable> { currentTable }; this.CreateTableList(currentTable, tableList); List<DataRelation> relationList = new List<DataRelation>(); this.CreateRelationList(tableList, relationList); if (relationList.Count == 0) { if (this.Columns.Count == 0) { DataTable table5 = currentTable; if (table5 != null) { table5.CloneTo(this, null, false); } if ((this.DataSet == null) && (this.tableNamespace == null)) { this.tableNamespace = table5.Namespace; } } } else { if (ADP.IsEmpty(this.TableName)) { this.TableName = currentTable.TableName; if (!ADP.IsEmpty(currentTable.Namespace)) { this.Namespace = currentTable.Namespace; } } if (this.DataSet == null) { System.Data.DataSet set2 = new System.Data.DataSet(set.DataSetName); set2.SetLocaleValue(set.Locale, set.ShouldSerializeLocale()); set2.CaseSensitive = set.CaseSensitive; set2.Namespace = set.Namespace; set2.mainTableName = set.mainTableName; set2.RemotingFormat = set.RemotingFormat; set2.Tables.Add(this); } this.CloneHierarchy(currentTable, this.DataSet, null); foreach (DataTable table2 in tableList) { DataTable table4 = this.DataSet.Tables[table2.tableName, table2.Namespace]; DataTable table6 = set.Tables[table2.tableName, table2.Namespace]; foreach (Constraint constraint3 in table6.Constraints) { ForeignKeyConstraint constraint = constraint3 as ForeignKeyConstraint; if (((constraint != null) && (constraint.Table != constraint.RelatedTable)) && (tableList.Contains(constraint.Table) && tableList.Contains(constraint.RelatedTable))) { ForeignKeyConstraint constraint2 = (ForeignKeyConstraint) constraint.Clone(table4.DataSet); if (!table4.Constraints.Contains(constraint2.ConstraintName)) { table4.Constraints.Add(constraint2); } } } } foreach (DataRelation relation in relationList) { if (!this.DataSet.Relations.Contains(relation.RelationName)) { this.DataSet.Relations.Add(relation.Clone(this.DataSet)); } } bool flag = false; foreach (DataTable table3 in tableList) { foreach (DataColumn column in table3.Columns) { flag = false; if (column.Expression.Length != 0) { DataColumn[] dependency = column.DataExpression.GetDependency(); for (int i = 0; i < dependency.Length; i++) { if (!tableList.Contains(dependency[i].Table)) { flag = true; break; } } } if (!flag) { this.DataSet.Tables[table3.TableName, table3.Namespace].Columns[column.ColumnName].Expression = column.Expression; } } flag = false; } } } } finally { Bid.ScopeLeave(ref ptr); } }