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
commandIDbCommandThe DbCommand to generate a reader from.
behaviorCommandBehaviorThe behavior to use with the data reader.
cancellationTokenCancellationTokenThe cancellation token.
Returns
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
commandDbCommandThe DbCommand to generate a reader from.
handlerAction<DbDataReader>The handler function for each IDataRecord.
behaviorCommandBehaviorThe behavior to use with the data reader.
cancellationTokenCancellationTokenThe cancellation token.
Returns
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
commandIDbCommandThe IDbCommand to generate a reader from.
handlerFunc<IDataReader, ValueTask>The handler function for each IDataRecord.
behaviorCommandBehaviorThe behavior to use with the data reader.
cancellationTokenCancellationTokenThe cancellation token.
Returns
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
commandDbCommandThe DbCommand to generate a reader from.
handlerFunc<DbDataReader, ValueTask>The handler function for the DbDataReader.
behaviorCommandBehaviorThe behavior to use with the data reader.
cancellationTokenCancellationTokenThe cancellation token.
Returns
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
commandDbCommandThe DbCommand to generate a reader from.
transformFunc<DbDataReader, T>The transform function for each IDataRecord.
behaviorCommandBehaviorThe behavior to use with the data reader.
cancellationTokenCancellationTokenThe cancellation token.
Returns
- ValueTask<T>
The result of the transform.
Type Parameters
TThe 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
commandIDbCommandThe IDbCommand to generate a reader from.
transformFunc<IDataReader, ValueTask<T>>The transform function for each IDataRecord.
behaviorCommandBehaviorThe behavior to use with the data reader.
cancellationTokenCancellationTokenThe cancellation token.
Returns
- ValueTask<T>
The result of the transform.
Type Parameters
TThe 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
commandDbCommandThe DbCommand to generate a reader from.
transformFunc<DbDataReader, ValueTask<T>>The transform function for each IDataRecord.
behaviorCommandBehaviorThe behavior to use with the data reader.
cancellationTokenCancellationTokenThe cancellation token.
Returns
- ValueTask<T>
The result of the transform.
Type Parameters
TThe return type of the transform function.