Table of Contents

Interface IDataQueryAsync

Namespace
FluentCommand
Assembly
FluentCommand.dll

An interface defining a data query operations asynchronously.

public interface IDataQueryAsync : IAsyncDisposable
Inherited Members
Extension Methods

Methods

QueryAsync<TEntity>(Func<IDataReader, TEntity>, CommandBehavior, CancellationToken)

Executes the command against the connection and converts the results to TEntity objects asynchronously.

Task<IEnumerable<TEntity>> QueryAsync<TEntity>(Func<IDataReader, TEntity> factory, CommandBehavior commandBehavior = CommandBehavior.SingleResult, CancellationToken cancellationToken = default)

Parameters

factory Func<IDataReader, TEntity>

The delegate factory to convert the IDataReader to TEntity.

commandBehavior CommandBehavior

Provides a description of the results of the query and its effect on the database.

cancellationToken CancellationToken

The cancellation instruction.

Returns

Task<IEnumerable<TEntity>>

An IEnumerable<T> of TEntity objects.

Type Parameters

TEntity

The type of the entity.

Exceptions

ArgumentNullException

factory is null

QuerySingleAsync<TEntity>(Func<IDataReader, TEntity>, CommandBehavior, CancellationToken)

Executes the query and returns the first row in the result as a TEntity object asynchronously.

Task<TEntity> QuerySingleAsync<TEntity>(Func<IDataReader, TEntity> factory, CommandBehavior commandBehavior = CommandBehavior.SingleResult | CommandBehavior.SingleRow, CancellationToken cancellationToken = default)

Parameters

factory Func<IDataReader, TEntity>

The delegate factory to convert the IDataReader to TEntity.

commandBehavior CommandBehavior

Provides a description of the results of the query and its effect on the database.

cancellationToken CancellationToken

The cancellation instruction.

Returns

Task<TEntity>

A instance of TEntity if row exists; otherwise null.

Type Parameters

TEntity

The type of the entity.

Exceptions

ArgumentNullException

factory is null

QueryTableAsync(CancellationToken)

Executes the command against the connection and converts the results to a DataTable asynchronously.

Task<DataTable> QueryTableAsync(CancellationToken cancellationToken = default)

Parameters

cancellationToken CancellationToken

The cancellation instruction.

Returns

Task<DataTable>

A DataTable of the results.

QueryValueAsync<TValue>(Func<object, TValue>, CancellationToken)

Executes the query and returns the first column of the first row in the result set returned by the query asynchronously. All other columns and rows are ignored.

Task<TValue> QueryValueAsync<TValue>(Func<object, TValue> convert, CancellationToken cancellationToken = default)

Parameters

convert Func<object, TValue>

The delegate to convert the value..

cancellationToken CancellationToken

The cancellation instruction.

Returns

Task<TValue>

The value of the first column of the first row in the result set.

Type Parameters

TValue

The type of the value.

ReadAsync(Func<IDataReader, CancellationToken, Task>, CommandBehavior, CancellationToken)

Executes the command against the connection and sends the resulting IDataReader to the readAction delegate.

Task ReadAsync(Func<IDataReader, CancellationToken, Task> readAction, CommandBehavior commandBehavior = CommandBehavior.Default, CancellationToken cancellationToken = default)

Parameters

readAction Func<IDataReader, CancellationToken, Task>

The read action delegate to pass the open IDataReader.

commandBehavior CommandBehavior

Provides a description of the results of the query and its effect on the database.

cancellationToken CancellationToken

The cancellation instruction.

Returns

Task