#if ASYNC
using System;
using System.Collections.Generic;
using System.Data;
using System.Data.Common;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
namespace Dapper
{
partial class SqlMapper
{
partial class GridReader
{
CancellationToken cancel;
internal GridReader(IDbCommand command, IDataReader reader, Identity identity, DynamicParameters dynamicParams, bool addToCache, CancellationToken cancel)
: this(command, reader, identity, dynamicParams, addToCache)
{
this.cancel = cancel;
}
///
/// Read the next grid of results, returned as a dynamic object
///
/// Note: each row can be accessed via "dynamic", or by casting to an IDictionary<string,object>
public Task> ReadAsync(bool buffered = true)
{
return ReadAsyncImpl(typeof(DapperRow), buffered);
}
///
/// Read an individual row of the next grid of results, returned as a dynamic object
///
/// Note: the row can be accessed via "dynamic", or by casting to an IDictionary<string,object>
public Task ReadFirstAsync()
{
return ReadRowAsyncImpl(typeof(DapperRow), Row.First);
}
///
/// Read an individual row of the next grid of results, returned as a dynamic object
///
/// Note: the row can be accessed via "dynamic", or by casting to an IDictionary<string,object>
public Task ReadFirstOrDefaultAsync()
{
return ReadRowAsyncImpl(typeof(DapperRow), Row.FirstOrDefault);
}
///
/// Read an individual row of the next grid of results, returned as a dynamic object
///
/// Note: the row can be accessed via "dynamic", or by casting to an IDictionary<string,object>
public Task ReadSingleAsync()
{
return ReadRowAsyncImpl(typeof(DapperRow), Row.Single);
}
///
/// Read an individual row of the next grid of results, returned as a dynamic object
///
/// Note: the row can be accessed via "dynamic", or by casting to an IDictionary<string,object>
public Task ReadSingleOrDefaultAsync()
{
return ReadRowAsyncImpl(typeof(DapperRow), Row.SingleOrDefault);
}
///
/// Read the next grid of results
///
public Task> ReadAsync(Type type, bool buffered = true)
{
if (type == null) throw new ArgumentNullException(nameof(type));
return ReadAsyncImpl