Table of Contents

Method SingleOrDefaultAsync

Namespace
Open.Database.Extensions
Assembly
Open.Database.Extensions.Core.dll

SingleOrDefaultAsync(CancellationToken)

Asynchronously reads the only mapped row.

public ValueTask<T?> SingleOrDefaultAsync(CancellationToken cancellationToken = default)

Parameters

cancellationToken CancellationToken

Cancels the operation. When it cannot be canceled, the cancellation token set on the underlying command applies.

Returns

ValueTask<T>

A task that produces the single row, or default if the query returns no rows.

Exceptions

OperationCanceledException

The operation was canceled.

InvalidOperationException

The query returns more than one row.

See Also