Method SingleResult
- Namespace
- Open.Database.Extensions
- Assembly
- Open.Database.Extensions.Core.dll
SingleResult()
Stops after the first result set and does not read through the later ones.
public MappedQuery<T> SingleResult()
Returns
- MappedQuery<T>
The same query, without the read-through.
Remarks
A result here is one whole result set, what NextResult() moves between; never a row.
By default a terminal returns the rows of the first result set only, then reads through the later ones without mapping them, so a failure in a later statement is thrown instead of lost.
A later failure can follow a write that already committed, so a caller that retries can repeat it, and the rows read are lost when it throws.
This call asserts nothing: it does not check that there is only one result set. It stops after the first, and a later failure goes unseen.
A read-through also does not happen when the caller stops reading early or the mapping, the selector or the caller's handler throws.
FirstOrDefault and First with nothing skipped also ask the provider for a single row.
command.SingleResult().Map<T>() (see SingleResult(IExecuteReader)) is the same as command.Map<T>().SingleResult().