Table of Contents

ExecuteScalarAsTypeAsync Method

Definition

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

ExecuteScalarAsTypeAsync(DataStatement, Type, 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 returnType. Additional columns or rows are ignored.

public virtual Task<object> ExecuteScalarAsTypeAsync(DataStatement statement, Type returnType, Action<ObjectFormattingOptions> setup = null, CancellationToken ct = default)

Parameters

statement DataStatement

The command statement to execute.

returnType Type

The type to return the first column value as.

setup Action<ObjectFormattingOptions>

The ObjectFormattingOptions which may be configured.

ct CancellationToken

A token to cancel the asynchronous operation.

Returns

Task<object>

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 the specified returnType.