public static RowDescriptor CreateRowDescriptor(IDataReader dataReader, DataReaderTraceOptions options) { List <ColumnDescriptor> columns = new List <ColumnDescriptor>(dataReader.FieldCount); for (int i = 0; i < dataReader.FieldCount; ++i) { string name = dataReader.GetName(i); Type type = dataReader.GetFieldType(i); ColumnDescriptor columnInfo = new ColumnDescriptor(i, name, type, options.MaxResultColumnWidth); columns.Add(columnInfo); } RowDescriptor result = new RowDescriptor(columns); return(result); }
public DataReaderTracer(IDataReader dataReader, DataReaderTraceOptions options) { Debug.Assert(dataReader != null && !dataReader.IsClosed); Debug.Assert(options != null); this.dataReader = dataReader; this.options = options; List <ColumnDescriptor> columnInfos = new List <ColumnDescriptor>(); for (int i = 0; i < dataReader.FieldCount; ++i) { string name = dataReader.GetName(i); Type type = dataReader.GetFieldType(i); ColumnDescriptor columnInfo = new ColumnDescriptor(i, name, type, options.MaxResultColumnWidth); columnInfos.Add(columnInfo); } this.columnDescriptors = columnInfos.ToArray(); }