using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Globalization;
namespace Dapper
{
partial class SqlMapper
{
///
/// The grid reader provides interfaces for reading multiple result sets from a Dapper query
///
public partial class GridReader : IDisposable
{
private IDataReader reader;
private Identity identity;
private bool addToCache;
internal GridReader(IDbCommand command, IDataReader reader, Identity identity, IParameterCallbacks callbacks, bool addToCache)
{
Command = command;
this.reader = reader;
this.identity = identity;
this.callbacks = callbacks;
this.addToCache = addToCache;
}
///
/// 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 IEnumerable Read(bool buffered = true)
{
return ReadImpl(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 dynamic ReadFirst()
{
return ReadRow(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 dynamic ReadFirstOrDefault()
{
return ReadRow(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 dynamic ReadSingle()
{
return ReadRow(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 dynamic ReadSingleOrDefault()
{
return ReadRow(typeof(DapperRow), Row.SingleOrDefault);
}
///
/// Read the next grid of results
///
public IEnumerable Read(bool buffered = true)
{
return ReadImpl(typeof(T), buffered);
}
///
/// Read an individual row of the next grid of results
///
public T ReadFirst()
{
return ReadRow(typeof(T), Row.First);
}
///
/// Read an individual row of the next grid of results
///
public T ReadFirstOrDefault()
{
return ReadRow(typeof(T), Row.FirstOrDefault);
}
///
/// Read an individual row of the next grid of results
///
public T ReadSingle()
{
return ReadRow(typeof(T), Row.Single);
}
///
/// Read an individual row of the next grid of results
///
public T ReadSingleOrDefault()
{
return ReadRow(typeof(T), Row.SingleOrDefault);
}
///
/// Read the next grid of results
///
public IEnumerable