DbCommand.ExecuteDbDataReaderAsync(CommandBehavior, CancellationToken) Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
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>
Protected Overridable Function ExecuteDbDataReaderAsync (behavior As CommandBehavior, cancellationToken As CancellationToken) As Task(Of DbDataReader)
Parameters
- behavior
- CommandBehavior
An instance of CommandBehavior, specifying options for command 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 command.
An invalid CommandBehavior value.
Remarks
For more information about asynchronous programming, see Asynchronous Programming.