public async Task <IReadOnlyList <T> > HandleAsync(DbDataReader reader, IMartenSession session, CancellationToken token) { var list = new List <T>(); if (await reader.ReadAsync(token).ConfigureAwait(false)) { _statistics.TotalResults = await reader.GetFieldValueAsync <int>(_countIndex, token).ConfigureAwait(false); var item = await _selector.ResolveAsync(reader, token).ConfigureAwait(false); list.Add(item); } else { // no data _statistics.TotalResults = 0; return(list); } // Get the rest of the data while (await reader.ReadAsync(token).ConfigureAwait(false)) { var item = await _selector.ResolveAsync(reader, token).ConfigureAwait(false); list.Add(item); } return(list); }
public async Task <T> HandleAsync(DbDataReader reader, IIdentityMap map, QueryStatistics stats, CancellationToken token) { var hasValue = await reader.ReadAsync(token).ConfigureAwait(false); return(hasValue ? await _selector.ResolveAsync(reader, map, stats, token).ConfigureAwait(false) : default(T)); }
public async Task <TSearched> ResolveAsync(DbDataReader reader, IIdentityMap map, QueryStatistics stats, CancellationToken token) { var included = await storage.ResolveAsync(StartingIndex, reader, map, token).ConfigureAwait(false); _callback(included); return(await _inner.ResolveAsync(reader, map, stats, token).ConfigureAwait(false)); }
public async Task ReadAsync(DbDataReader reader, CancellationToken token) { while (await reader.ReadAsync(token).ConfigureAwait(false)) { var item = await _selector.ResolveAsync(reader, token).ConfigureAwait(false); _callback(item); } }
public static async Task <IReadOnlyList <T> > ReadAsync <T>(this ISelector <T> selector, DbDataReader reader, IIdentityMap map, QueryStatistics stats, CancellationToken token) { var list = new List <T>(); while (await reader.ReadAsync(token).ConfigureAwait(false)) { list.Add(await selector.ResolveAsync(reader, map, stats, token).ConfigureAwait(false)); } return(list); }
internal static async Task <T> LoadOneAsync <T>(this IManagedConnection connection, NpgsqlCommand command, ISelector <T> selector, CancellationToken token) { using (var reader = await connection.ExecuteReaderAsync(command, token)) { if (!(await reader.ReadAsync(token))) { return(default(T)); } return(await selector.ResolveAsync(reader, token)); } }
public async Task <IReadOnlyList <T> > HandleAsync(DbDataReader reader, IMartenSession session, QueryStatistics stats, CancellationToken token) { var list = new List <T>(); while (await reader.ReadAsync(token).ConfigureAwait(false)) { var item = await _selector.ResolveAsync(reader, token).ConfigureAwait(false); list.Add(item); } return(list); }
public async Task <T> HandleAsync(DbDataReader reader, IIdentityMap map, CancellationToken token) { var hasResult = await reader.ReadAsync(token).ConfigureAwait(false); if (!hasResult) { if (_canBeNull) { return(default(T)); } throw new InvalidOperationException(NoElementsMessage); } var result = await _selector.ResolveAsync(reader, map, token).ConfigureAwait(false); if (!_canBeMultiples && await reader.ReadAsync(token).ConfigureAwait(false)) { throw new InvalidOperationException(MoreThanOneElementMessage); } return(result); }
public Task <T> ResolveAsync(DbDataReader reader, IIdentityMap map, CancellationToken token) { return(_inner.ResolveAsync(reader, map, token)); }
public async Task <T> ResolveAsync(DbDataReader reader, CancellationToken token) { return((T)(await _inner.ResolveAsync(reader, token))); }