Επεξεργασία

Κοινή χρήση μέσω


DbBatch.ExecuteReaderAsync Method

Definition

Overloads

ExecuteReaderAsync(CancellationToken)

An asynchronous version of ExecuteReader, which executes the batch against its connection, returning a DbDataReader which can be used to access the results.

ExecuteReaderAsync(CommandBehavior, CancellationToken)

An asynchronous version of ExecuteReader, which executes the batch against its connection, returning a DbDataReader which can be used to access the results.

ExecuteReaderAsync(CancellationToken)

Source:
DbBatch.cs
Source:
DbBatch.cs
Source:
DbBatch.cs

An asynchronous version of ExecuteReader, which executes the batch against its connection, returning a DbDataReader which can be used to access the results.

public System.Threading.Tasks.Task<System.Data.Common.DbDataReader> ExecuteReaderAsync (System.Threading.CancellationToken cancellationToken = default);
member this.ExecuteReaderAsync : System.Threading.CancellationToken -> System.Threading.Tasks.Task<System.Data.Common.DbDataReader>
Public Function ExecuteReaderAsync (Optional cancellationToken As CancellationToken = Nothing) As Task(Of DbDataReader)

Parameters

cancellationToken
CancellationToken

Returns

A task representing the asynchronous operation.

Exceptions

An error occurred while executing the batch.

The CommandBehavior value is invalid.

The cancellation token was canceled. This exception is stored into the returned task.

Remarks

Managed provider implementers must call ExecuteDbDataReaderAsync in ExecuteReaderAsync. For more information about asynchronous programming, see Asynchronous Programming.

Applies to

ExecuteReaderAsync(CommandBehavior, CancellationToken)

Source:
DbBatch.cs
Source:
DbBatch.cs
Source:
DbBatch.cs

An asynchronous version of ExecuteReader, which executes the batch against its connection, returning a DbDataReader which can be used to access the results.

public System.Threading.Tasks.Task<System.Data.Common.DbDataReader> ExecuteReaderAsync (System.Data.CommandBehavior behavior, System.Threading.CancellationToken cancellationToken = default);
member this.ExecuteReaderAsync : System.Data.CommandBehavior * System.Threading.CancellationToken -> System.Threading.Tasks.Task<System.Data.Common.DbDataReader>
Public Function ExecuteReaderAsync (behavior As CommandBehavior, Optional cancellationToken As CancellationToken = Nothing) As Task(Of DbDataReader)

Parameters

behavior
CommandBehavior

One of the enumeration values that specifies options for batch execution and data retrieval.

cancellationToken
CancellationToken

A token to cancel the asynchronous operation.

Returns

A task representing the asynchronous operation.

Exceptions

An error occurred while executing the batch.

The CommandBehavior value is invalid.

The cancellation token was canceled. This exception is stored into the returned task.

Remarks

Managed provider implementers must call ExecuteDbDataReaderAsync in ExecuteReaderAsync. For more information about asynchronous programming, see Asynchronous Programming.

This method stores in the task it returns all non-usage exceptions that the method's synchronous counterpart can throw. If an exception is stored into the returned task, that exception will be thrown when the task is awaited. Usage exceptions, such as ArgumentException, are still thrown synchronously. For the stored exceptions, see the exceptions thrown by ExecuteReader(CommandBehavior).

Applies to