Langue

SqlBatch.ExecuteDbDataReaderAsync(CommandBehavior, CancellationToken) Méthode

Définition

Cette implémentation appelle la ExecuteReaderAsync() méthode et retourne une tâche terminée. L’implémentation par défaut retourne une tâche annulée si elle a passé un jeton d’annulation déjà annulé. Cette méthode accepte un jeton d’annulation qui peut être utilisé pour demander l’annulation anticipée de l’opération.

protected:
 virtual 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);
protected virtual 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);
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>
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)
Protected Overrides Function ExecuteDbDataReaderAsync (behavior As CommandBehavior, cancellationToken As CancellationToken) As Task(Of DbDataReader)

Paramètres

behavior
CommandBehavior

Instance de , spécification d’options CommandBehaviorpour l’exécution par lots et la récupération des données. Seuls SequentialAccess et CloseConnection sont pris en charge au niveau du lot.

cancellationToken
CancellationToken

Jeton pour annuler l’opération asynchrone.

Retours

Tâche représentant l’opération asynchrone.

Exceptions

Le jeton d’annulation a été annulé. Cette exception est stockée dans la tâche retournée.

Remarques

Pour plus d’informations sur la programmation asynchrone, consultez Programmation asynchrone.

Cette méthode stocke dans la tâche toutes les exceptions non-utilisation que l’équivalent synchrone de la méthode peut lever. Si une exception est stockée dans la tâche retournée, cette exception est levée lorsque la tâche est attendue. Les exceptions d’utilisation, telles que ArgumentException, sont toujours levées de façon synchrone. Pour les exceptions stockées, consultez les exceptions levées par ExecuteDbDataReader(CommandBehavior).

Note

Cette méthode tire parti de ExecuteReaderAsync(CancellationToken), et toutes les exceptions attendues de cette méthode s’appliquent également ici.

S’applique à