SqlBatch.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.
This implementation invokes the ExecuteReaderAsync() method and returns a completed task. The default implementation will return a cancelled task if passed an already cancelled cancellation token.
This method accepts a cancellation token that can be used to request the operation to be cancelled early.
protected:
override System::Threading::Tasks::Task<System::Data::Common::DbDataReader ^> ^ ExecuteDbDataReaderAsync(System::Data::CommandBehavior behavior, System::Threading::CancellationToken cancellationToken);
protected override System.Threading.Tasks.Task<System.Data.Common.DbDataReader> ExecuteDbDataReaderAsync (System.Data.CommandBehavior behavior, System.Threading.CancellationToken cancellationToken);
override this.ExecuteDbDataReaderAsync : System.Data.CommandBehavior * System.Threading.CancellationToken -> System.Threading.Tasks.Task<System.Data.Common.DbDataReader>
Protected Overrides Function ExecuteDbDataReaderAsync (behavior As CommandBehavior, cancellationToken As CancellationToken) 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
The cancellation token was canceled. This exception is stored into the returned task.
Remarks
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 ExecuteDbDataReader(CommandBehavior).
Note
This method benefits from ExecuteReaderAsync(CancellationToken), and all the expected exceptions of that method also apply here.