Table of Contents

ExecuteScalarAsAsync Method

Definition

Namespace
Cuemon.Data
Assemblies
Cuemon.Data.dll
Source
src/Cuemon.Data/DataManager.cs

ExecuteScalarAsAsync<TResult>(DataStatement, Action<ObjectFormattingOptions>, CancellationToken)

Asynchronously executes the command statement, and attempts to convert the first column of the first row in the result set to the specified TResult. Additional columns or rows are ignored.

public virtual Task<TResult> ExecuteScalarAsAsync<TResult>(DataStatement statement, Action<ObjectFormattingOptions> setup = null, CancellationToken ct = default)

Parameters

statement DataStatement

The command statement to execute.

setup Action<ObjectFormattingOptions>

The ObjectFormattingOptions which may be configured.

ct CancellationToken

A token to cancel the asynchronous operation.

Returns

Task<TResult>

A task that represents the asynchronous operation. The task result contains the first column of the first column of the first row in the result from statement as TResult.

Type Parameters

TResult

The type of the return value.

Remarks

This method uses InvariantCulture when casting the first column of the first row in the result from statement.

Exceptions

AggregateException

The first column of the first row in the result set could not be converted.

See Also