DevExpress.DataAccess.BigQuery.BigQueryCommand.ExecuteScalarAsync C# (CSharp) Method

ExecuteScalarAsync() public method

Asynchronously executes a SQL statement. The asynchronous result contains the first column of the first row of the resulting data.
public ExecuteScalarAsync ( CancellationToken cancellationToken ) : Task
cancellationToken System.Threading.CancellationToken A cancellation token that can be used to cancel command execution.
return Task
        public override async Task<object> ExecuteScalarAsync(CancellationToken cancellationToken) {
            cancellationToken.ThrowIfCancellationRequested();
            cancellationToken.Register(Cancel);
            object result = null;
            using(DbDataReader dbDataReader = await ExecuteDbDataReaderAsync(CommandBehavior.Default, cancellationToken).ConfigureAwait(false)) {
                if(await dbDataReader.ReadAsync(cancellationToken).ConfigureAwait(false))
                    if(dbDataReader.FieldCount > 0)
                        result = dbDataReader.GetValue(0);
            }
            return result;
        }