Table of Contents

Method ExecuteReaderAsync

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

ExecuteReaderAsync(IDbCommand, CommandBehavior, CancellationToken)

If the command is derived from DbCommand, this will call ExecuteReaderAsync(CommandBehavior, CancellationToken); otherwise it will call ExecuteReader(CommandBehavior).

public static ValueTask<IDataReader> ExecuteReaderAsync(this IDbCommand command, CommandBehavior behavior = CommandBehavior.Default, CancellationToken cancellationToken = default)

Parameters

command IDbCommand

The DbCommand to generate a reader from.

behavior CommandBehavior

The behavior to use with the data reader.

cancellationToken CancellationToken

The cancellation token.

Returns

ValueTask<IDataReader>

ExecuteReaderAsync(DbCommand, Action<DbDataReader>, CommandBehavior, CancellationToken)

Asynchronously executes a reader on a command with a handler function.

public static ValueTask ExecuteReaderAsync(this DbCommand command, Action<DbDataReader> handler, CommandBehavior behavior = CommandBehavior.Default, CancellationToken cancellationToken = default)

Parameters

command DbCommand

The DbCommand to generate a reader from.

handler Action<DbDataReader>

The handler function for each IDataRecord.

behavior CommandBehavior

The behavior to use with the data reader.

cancellationToken CancellationToken

The cancellation token.

Returns

ValueTask

ExecuteReaderAsync(IDbCommand, Func<IDataReader, ValueTask>, CommandBehavior, CancellationToken)

Asynchronously executes a reader on a command with a handler function.

public static ValueTask ExecuteReaderAsync(this IDbCommand command, Func<IDataReader, ValueTask> handler, CommandBehavior behavior = CommandBehavior.Default, CancellationToken cancellationToken = default)

Parameters

command IDbCommand

The IDbCommand to generate a reader from.

handler Func<IDataReader, ValueTask>

The handler function for each IDataRecord.

behavior CommandBehavior

The behavior to use with the data reader.

cancellationToken CancellationToken

The cancellation token.

Returns

ValueTask

ExecuteReaderAsync(DbCommand, Func<DbDataReader, ValueTask>, CommandBehavior, CancellationToken)

Asynchronously executes a reader on a command with a handler function.

public static ValueTask ExecuteReaderAsync(this DbCommand command, Func<DbDataReader, ValueTask> handler, CommandBehavior behavior = CommandBehavior.Default, CancellationToken cancellationToken = default)

Parameters

command DbCommand

The DbCommand to generate a reader from.

handler Func<DbDataReader, ValueTask>

The handler function for the DbDataReader.

behavior CommandBehavior

The behavior to use with the data reader.

cancellationToken CancellationToken

The cancellation token.

Returns

ValueTask

ExecuteReaderAsync<T>(DbCommand, Func<DbDataReader, T>, CommandBehavior, CancellationToken)

Asynchronously executes a reader on a command with a transform function.

public static ValueTask<T> ExecuteReaderAsync<T>(this DbCommand command, Func<DbDataReader, T> transform, CommandBehavior behavior = CommandBehavior.Default, CancellationToken cancellationToken = default)

Parameters

command DbCommand

The DbCommand to generate a reader from.

transform Func<DbDataReader, T>

The transform function for each IDataRecord.

behavior CommandBehavior

The behavior to use with the data reader.

cancellationToken CancellationToken

The cancellation token.

Returns

ValueTask<T>

The result of the transform.

Type Parameters

T

The return type of the transform function.

ExecuteReaderAsync<T>(IDbCommand, Func<IDataReader, ValueTask<T>>, CommandBehavior, CancellationToken)

Asynchronously executes a reader on a command with a transform function.

public static ValueTask<T> ExecuteReaderAsync<T>(this IDbCommand command, Func<IDataReader, ValueTask<T>> transform, CommandBehavior behavior = CommandBehavior.Default, CancellationToken cancellationToken = default)

Parameters

command IDbCommand

The IDbCommand to generate a reader from.

transform Func<IDataReader, ValueTask<T>>

The transform function for each IDataRecord.

behavior CommandBehavior

The behavior to use with the data reader.

cancellationToken CancellationToken

The cancellation token.

Returns

ValueTask<T>

The result of the transform.

Type Parameters

T

The return type of the transform function.

ExecuteReaderAsync<T>(DbCommand, Func<DbDataReader, ValueTask<T>>, CommandBehavior, CancellationToken)

Asynchronously executes a reader on a command with a transform function.

public static ValueTask<T> ExecuteReaderAsync<T>(this DbCommand command, Func<DbDataReader, ValueTask<T>> transform, CommandBehavior behavior = CommandBehavior.Default, CancellationToken cancellationToken = default)

Parameters

command DbCommand

The DbCommand to generate a reader from.

transform Func<DbDataReader, ValueTask<T>>

The transform function for each IDataRecord.

behavior CommandBehavior

The behavior to use with the data reader.

cancellationToken CancellationToken

The cancellation token.

Returns

ValueTask<T>

The result of the transform.

Type Parameters

T

The return type of the transform function.