Class BatchQuery<TResult>
Terminal of a batch: materialises the rows of the batch's result-bearing query. The whole batch — the preceding statements and this query — executes as one round trip.
public sealed class BatchQuery<TResult>
Type Parameters
TResultThe projected row type.
- Inheritance
-
BatchQuery<TResult>
- Inherited Members
- Extension Methods
Methods
ToAsyncEnumerable(CancellationToken)
Streams the batch's result rows. The underlying reader stays open for the whole batch, so the batch executes when enumeration starts and its connection is held until enumeration completes.
public IAsyncEnumerable<TResult> ToAsyncEnumerable(CancellationToken cancellationToken = default)
Parameters
cancellationTokenCancellationTokenCancels enumeration.
Returns
- IAsyncEnumerable<TResult>
An asynchronous sequence over the result rows.
Exceptions
- NotSupportedException
The dialect cannot express the batch or one of its statements.
ToList()
Executes the batch and materialises the result rows.
public List<TResult> ToList()
Returns
- List<TResult>
The result rows, in result-set order.
Exceptions
- NotSupportedException
The dialect cannot express the batch or one of its statements.
ToListAsync(CancellationToken)
Asynchronously executes the batch and materialises the result rows.
public Task<List<TResult>> ToListAsync(CancellationToken cancellationToken = default)
Parameters
cancellationTokenCancellationTokenCancels execution.
Returns
Exceptions
- NotSupportedException
The dialect cannot express the batch or one of its statements.
ToSql()
Renders the whole batch (statements joined with ;) without executing it.
public string ToSql()
Returns
- string
The rendered SQL text.
Exceptions
- NotSupportedException
The dialect cannot express the batch or one of its statements.