public IEnumerable <TItem> Read <TItem>() { TableIdentity heading = TableIdentity.FromRecord(this.syncReader); ResultState <TItem> state = ResultCache <TItem> .GetResultState(this.schemas, heading); while (this.syncReader.Read()) { yield return(state.Item(this.syncReader)); } }
public async IAsyncEnumerable <TItem> ReadAsync <TItem>([EnumeratorCancellation] CancellationToken cancellationToken = default) { if (this.asyncReader == null) { throw new QueryException("Async not available. To use async operations, please supply a connection factory returning a DbConnection instance."); } TableIdentity heading = TableIdentity.FromRecord(this.asyncReader); ResultState <TItem> state = ResultCache <TItem> .GetResultState(this.schemas, heading); while (await this.asyncReader.ReadAsync(cancellationToken).ConfigureAwait(false)) { yield return(state.Item(this.asyncReader)); } }