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 operation. When it cannot be canceled, the cancellation token set on the underlying command applies.
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
-
SingleOrDefault<T>(IMappedQuery<T>)