Table of Contents

Method FirstOrdinalResultsAsync

Namespace
Open.Database.Extensions
Assembly
Open.Database.Extensions.Core.dll

FirstOrdinalResultsAsync(DbCommand, CommandBehavior, bool, CancellationToken)

Reads the first column from every record.

public static ValueTask<IEnumerable<object?>> FirstOrdinalResultsAsync(this DbCommand command, CommandBehavior behavior = CommandBehavior.SequentialAccess, bool useReadAsync = true, CancellationToken cancellationToken = default)

Parameters

command DbCommand

The IDbCommand to generate a reader from.

behavior CommandBehavior

The behavior to use with the data reader.

useReadAsync bool

If true (default) will iterate the results using .ReadAsync() otherwise will only Execute the reader asynchronously and then use .Read() to iterate the results but still allowing cancellation.

cancellationToken CancellationToken

The cancellation token.

Returns

ValueTask<IEnumerable<object>>

The enumerable of casted values.

Remarks

DBNull values are converted to null.

FirstOrdinalResultsAsync<T0>(DbCommand, CommandBehavior, bool, CancellationToken)

Reads the first column from every record.

public static ValueTask<IEnumerable<T0>> FirstOrdinalResultsAsync<T0>(this DbCommand command, CommandBehavior behavior = CommandBehavior.SequentialAccess, bool useReadAsync = true, CancellationToken cancellationToken = default)

Parameters

command DbCommand

The IDbCommand to generate a reader from.

behavior CommandBehavior

The behavior to use with the data reader.

useReadAsync bool

If true (default) will iterate the results using .ReadAsync() otherwise will only Execute the reader asynchronously and then use .Read() to iterate the results but still allowing cancellation.

cancellationToken CancellationToken

The cancellation token.

Returns

ValueTask<IEnumerable<T0>>

The enumerable of casted values.

Type Parameters

T0

The expected type of the first ordinal.

Remarks

Any DBNull values are then converted to null and casted to type T0.