Exemplo n.º 1
0
 /// <summary>
 /// Asynchronously returns the first record from the query result.
 /// </summary>
 /// <returns>depending on T, single value or all fields values from the first record</returns>
 public Task <T> SingleAsync <T>(CancellationToken cancel)
 {
     using (var selectCmd = GetSelectCmd()) {
         return(DataHelper.ExecuteReaderAsync <T>(selectCmd, CommandBehavior.SingleRow, DataReaderRecordOffset, 1,
                                                  new SingleDataReaderResult <T>(Read <T>), cancel
                                                  ));
     }
 }
Exemplo n.º 2
0
 /// <summary>
 /// Asynchronously returns all query results as <see cref="RecordSet"/>.
 /// </summary>
 public Task <RecordSet> ToRecordSetAsync(CancellationToken cancel)
 {
     using (var selectCmd = GetSelectCmd()) {
         return(DataHelper.ExecuteReaderAsync <RecordSet>(selectCmd, CommandBehavior.Default, DataReaderRecordOffset, RecordCount,
                                                          new RecordSetDataReaderResult(), cancel
                                                          ));
     }
 }
Exemplo n.º 3
0
 /// <summary>
 /// Asynchronously a list of dictionaries with all query results.
 /// </summary>
 public Task <List <Dictionary <string, object> > > ToDictionaryListAsync(CancellationToken cancel)
 {
     using (var selectCmd = GetSelectCmd()) {
         return(DataHelper.ExecuteReaderAsync <List <Dictionary <string, object> > >(selectCmd, CommandBehavior.Default, DataReaderRecordOffset, RecordCount,
                                                                                     new ListDataReaderResult <Dictionary <string, object> >(ReadDictionary), cancel
                                                                                     ));
     }
 }
Exemplo n.º 4
0
 /// <summary>
 /// Asynchronously returns a list with all query results.
 /// </summary>
 public Task <List <T> > ToListAsync <T>(CancellationToken cancel)
 {
     using (var selectCmd = GetSelectCmd()) {
         return(DataHelper.ExecuteReaderAsync <List <T> >(selectCmd, CommandBehavior.Default, DataReaderRecordOffset, RecordCount,
                                                          new ListDataReaderResult <T>(Read <T>), cancel
                                                          ));
     }
 }
Exemplo n.º 5
0
 /// <summary>
 /// Asynchronously returns dictionary with first record values.
 /// </summary>
 public Task <Dictionary <string, object> > ToDictionaryAsync(CancellationToken cancel)
 {
     using (var selectCmd = GetSelectCmd()) {
         return(DataHelper.ExecuteReaderAsync <Dictionary <string, object> >(
                    selectCmd, CommandBehavior.SingleRow, DataReaderRecordOffset, 1,
                    new SingleDataReaderResult <Dictionary <string, object> >(ReadDictionary), cancel
                    ));
     }
 }