Exemple #1
0
        private RowSetCollectionData ProcessData(IDataReader reader)
        {
            var result = new RowSetCollectionData();

            do
            {
                MetadataBuilder.Build(reader);
                var rowset = new RowSetData();
                while (reader.Read())
                {
                    var row     = new AtomCollectionData();
                    var columns = MetadataBuilder.Columns.OrderBy(c => c.Ordinal);
                    foreach (var column in columns)
                    {
                        try
                        {
                            var atom = new AtomData();
                            atom.Name  = column.Name;
                            atom.Value = reader.GetValue(column.Ordinal);
                            row.AddAtom(atom);
                        }
                        catch (Exception ex)
                        {
                            throw new Exception($"Error reading column {column.Ordinal} ({column.Name})", ex);
                        }
                    }
                    rowset.AddRow(row);
                }
                result.AddRowSet(rowset);
            }while (reader.NextResult());
            return(result);
        }
 /// <summary>
 /// Add a new row set to the row set collection.
 /// </summary>
 /// <param name="rowset">The row set to add</param>
 public void AddRowSet(RowSetData rowset)
 {
     _rowsets.Add(rowset);
 }