internal GridReader(IDbCommand command, IDataReader reader, Identity identity, DynamicParameters dynamicParams, CancellationToken cancel) : this(command, reader, identity, dynamicParams) { this.cancel = cancel; }
private async Task <IEnumerable <T> > ReadBufferedAsync <T>(int index, Func <IDataReader, object> deserializer, Identity typedIdentity) { //try //{ var reader = (DbDataReader)this.reader; List <T> buffer = new List <T>(); while (index == gridIndex && await reader.ReadAsync(cancel).ConfigureAwait(false)) { buffer.Add((T)deserializer(reader)); } if (index == gridIndex) // need to do this outside of the finally pre-C#6 { await NextResultAsync().ConfigureAwait(false); } return(buffer); //} //finally // finally so that First etc progresses things even when multiple rows //{ // if (index == gridIndex) // { // await NextResultAsync().ConfigureAwait(false); // } //} }
public IEnumerable <T> ReadDeferred <T>(int index, Func <IDataReader, object> deserializer, Identity typedIdentity) { try { while (index == gridIndex && reader.Read()) { yield return((T)deserializer(reader)); } } finally // finally so that First etc progresses things even when multiple rows { if (index == gridIndex) { NextResult(); } } }