Method FirstOrDefaultAsync
- Namespace
- Open.Database.Extensions
- Assembly
- Open.Database.Extensions.Core.dll
FirstOrDefaultAsync(CancellationToken)
Asynchronously reads the first mapped row.
public ValueTask<T?> FirstOrDefaultAsync(CancellationToken cancellationToken = default)
Parameters
cancellationTokenCancellationTokenCancels the call, together with the cancellation token set on the underlying command: either one cancels it, whether it is opening the connection, looking up stored-procedure parameter names, executing or reading.
Returns
Remarks
Rows after the first are not mapped. Add an ORDER BY to the SQL when "first" must be deterministic.
Exceptions
- OperationCanceledException
The operation was canceled.
- See Also
-
FirstOrDefault<T>(MappedQuery<T>)