/// <summary> /// Initializes a database table using data from the specified reader. /// </summary> public DbDataRaw() { // Initialize the handler. this.handler = new AddRowAction(this.AddFirstRow); }
/// <summary> /// Adds the first row to the database table. /// </summary> /// <param name="reader">The database reader.</param> private void AddFirstRow(DbReader reader) { // Initialize the number of columns based on the data from the reader. this.columnCount = reader.ColumnCount; // Initialize the column names. this.names = new string[this.columnCount]; // Initialize tha column mappings. for (int index = 0; index < this.columnCount; index++) { this.names[index] = reader.GetName(index); this.mapping.Add(this.names[index], index); } // Change the handler. this.handler = new AddRowAction(this.AddNextRow); // Add the first row to the table. this.AddNextRow(reader); }