Method ExecuteReturnAsync
- Namespace
- Open.Database.Extensions
- Assembly
- Open.Database.Extensions.Core.dll
ExecuteReturnAsync(CancellationToken)
Asynchronously executes the command with a return parameter, as ExecuteNonQueryAsync(CancellationToken) does, and returns the value of that parameter.
public ValueTask<object?> ExecuteReturnAsync(CancellationToken cancellationToken = default)
Parameters
cancellationTokenCancellationTokenA token that can cancel the call. It is used together with the command's own token (see UseCancellationToken(CancellationToken)); either one cancels.
Returns
Exceptions
- OperationCanceledException
The command's token or
cancellationTokenis already canceled; thrown before anything runs.
ExecuteReturnAsync<T>(CancellationToken)
Asynchronously executes the command with a return parameter, as
ExecuteNonQueryAsync(CancellationToken) does,
and returns the value of that parameter converted to
T.
public ValueTask<T> ExecuteReturnAsync<T>(CancellationToken cancellationToken = default)
Parameters
cancellationTokenCancellationTokenA token that can cancel the call. It is used together with the command's own token (see UseCancellationToken(CancellationToken)); either one cancels.
Returns
- ValueTask<T>
The value from the return parameter, converted to
TasMap<T>()converts a column: a value that is already aTis returned as is, an integer is converted to another integer type with a range check, and any other value takes the general conversion. null when it is NULL andTtakes it.
Type Parameters
TThe type to convert the value to.
Exceptions
- ValueMappingException
The value does not convert to
T, or is out of its range, or it is NULL andTis a non-nullable value type.