DbCommand.ExecuteDbDataReaderAsync(CommandBehavior, CancellationToken) DbCommand.ExecuteDbDataReaderAsync(CommandBehavior, CancellationToken) DbCommand.ExecuteDbDataReaderAsync(CommandBehavior, CancellationToken) Method

Definition

Providers should implement this method to provide a non-default implementation for ExecuteReader overloads.

The default implementation invokes the synchronous ExecuteReader() method and returns a completed task, blocking the calling thread. The default implementation will return a cancelled task if passed an already cancelled cancellation token. Exceptions thrown by ExecuteReader will be communicated via the returned Task Exception property.

This method accepts a cancellation token that can be used to request the operation to be cancelled early. Implementations may ignore this request.

protected:
 virtual System::Threading::Tasks::Task<System::Data::Common::DbDataReader ^> ^ ExecuteDbDataReaderAsync(System::Data::CommandBehavior behavior, System::Threading::CancellationToken cancellationToken);
protected virtual System.Threading.Tasks.Task<System.Data.Common.DbDataReader> ExecuteDbDataReaderAsync (System.Data.CommandBehavior behavior, System.Threading.CancellationToken cancellationToken);
abstract member ExecuteDbDataReaderAsync : System.Data.CommandBehavior * System.Threading.CancellationToken -> System.Threading.Tasks.Task<System.Data.Common.DbDataReader>
override this.ExecuteDbDataReaderAsync : System.Data.CommandBehavior * System.Threading.CancellationToken -> System.Threading.Tasks.Task<System.Data.Common.DbDataReader>
Parameters
behavior
CommandBehavior CommandBehavior CommandBehavior

Options for statement execution and data retrieval.

cancellationToken
CancellationToken CancellationToken CancellationToken

The token to monitor for cancellation requests.

Returns

A task representing the asynchronous operation.

Exceptions

An error occurred while executing the command text.

Remarks

For more information about asynchronous programming, see Asynchronous Programming.

Applies to