Table of Contents

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

cancellationToken CancellationToken

A token that can cancel the call. It is used together with the command's own token (see UseCancellationToken(CancellationToken)); either one cancels.

Returns

ValueTask<object>

The value from the return parameter.

Exceptions

OperationCanceledException

The command's token or cancellationToken is 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

cancellationToken CancellationToken

A 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 T as Map<T>() converts a column: a value that is already a T is 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 and T takes it.

Type Parameters

T

The 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 and T is a non-nullable value type.