예제 #1
0
        private static DbSchemaRow[] GetSortedSchemaRows(DataTable dataTable, bool returnProviderSpecificTypes)
        {
            DataColumn column = dataTable.Columns[SchemaMappingUnsortedIndex];
            if (column == null)
            {
                column = new DataColumn(SchemaMappingUnsortedIndex, typeof (int));
                dataTable.Columns.Add(column);
            }

            int count = dataTable.Rows.Count;
            for (int index = 0; index < count; ++index)
            {
                dataTable.Rows[index][column] = index;
            }
            
            var schemaTable = new DbSchemaTable(dataTable, returnProviderSpecificTypes);
            DataRow[] dataRowArray = dataTable.Select(null, "ColumnOrdinal ASC", DataViewRowState.CurrentRows);
            
            var dbSchemaRowArray = new DbSchemaRow[dataRowArray.Length];
            for (int index = 0; index < dataRowArray.Length; ++index)
            {
                dbSchemaRowArray[index] = new DbSchemaRow(schemaTable, dataRowArray[index]);
            }
            
            return dbSchemaRowArray;
        }
예제 #2
0
 internal DbSchemaRow(DbSchemaTable schemaTable, DataRow dataRow)
 {
     this.schemaTable = schemaTable;
     this.dataRow = dataRow;
 }