Struct MappedQuery<T>
- Namespace
- Open.Database.Extensions
- Assembly
- Open.Database.Extensions.Core.dll
A deferred, type-locked query over any IExecuteReader. Terminals are methods here, with more as extensions on IMappedQuery<T>.
public readonly record struct MappedQuery<T> : IMappedQuery<T>, IEquatable<MappedQuery<T>>
Type Parameters
TThe type each record is mapped to.
- Implements
-
IMappedQuery<T>
- Inherited Members
- Extension Methods
Methods
- FirstOrDefault()
Reads the first mapped row.
- FirstOrDefaultAsync(CancellationToken)
Asynchronously reads the first mapped row.
- Read(Action<IEnumerable<T>>)
Executes the query and passes the mapped rows to
handleras they are read.
- ReadAsync(Func<IAsyncEnumerable<T>, CancellationToken, ValueTask>, CancellationToken)
Asynchronously executes the query and passes the mapped rows to
handleras they are read.
- ReadAsync<TResult>(Func<IAsyncEnumerable<T>, CancellationToken, ValueTask<TResult>>, CancellationToken)
Asynchronously executes the query, passes the mapped rows to
handleras they are read, and returns the handler's result.
- Read<TResult>(Func<IEnumerable<T>, TResult>)
Executes the query, passes the mapped rows to
handleras they are read, and returns the handler's result.
- SingleOrDefault()
Reads the only mapped row.
- SingleOrDefaultAsync(CancellationToken)
Asynchronously reads the only mapped row.
- Skip(int)
Skips the first
countmapped records.
- Take(int)
Limits the result to at most
countmapped records.
- ToArray()
Reads every mapped row into a new array.
- ToArrayAsync(CancellationToken)
Asynchronously reads every mapped row into a new array.
- ToDictionaryAsync<TKey>(Func<T, TKey>, IEqualityComparer<TKey>?, CancellationToken)
Asynchronously reads every mapped row into a new Dictionary<TKey, TValue>, keyed by
keySelector.
- ToDictionary<TKey>(Func<T, TKey>, IEqualityComparer<TKey>?)
Reads every mapped row into a new Dictionary<TKey, TValue>, keyed by
keySelector.
- ToHashSet(IEqualityComparer<T>?)
Reads every mapped row into a new HashSet<T>.
- ToHashSetAsync(IEqualityComparer<T>?, CancellationToken)
Asynchronously reads every mapped row into a new HashSet<T>.
- ToImmutableArray()
Reads every mapped row into a new ImmutableArray<T>.
- ToImmutableArrayAsync(CancellationToken)
Asynchronously reads every mapped row into a new ImmutableArray<T>.
- ToListAsync(CancellationToken)
Asynchronously reads every mapped row into a new List<T>.