Język

SqlBatch.ExecuteDbDataReaderAsync(CommandBehavior, CancellationToken) Metoda

Definicja

Ta implementacja wywołuje metodę ExecuteReaderAsync() i zwraca ukończone zadanie. Domyślna implementacja zwróci anulowane zadanie, jeśli przekazano już anulowany token anulowania. Ta metoda akceptuje token anulowania, który może służyć do żądania wcześniejszego anulowania operacji.

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)

Parametry

behavior
CommandBehavior

Wystąpienie klasy CommandBehavior, określając opcje wykonywania wsadowego i pobierania danych. Tylko SequentialAccess i CloseConnection są obsługiwane na poziomie partii.

cancellationToken
CancellationToken

Token umożliwiający anulowanie operacji asynchronicznej.

Zwraca

Zadanie reprezentujące operację asynchroniczną.

Wyjątki

Token anulowania został anulowany. Ten wyjątek jest przechowywany w zwracanym zadaniu.

Uwagi

Aby uzyskać więcej informacji na temat programowania asynchronicznego, zobacz Programowanie asynchroniczne.

Ta metoda przechowuje w zadaniu zwraca wszystkie wyjątki inne niż użycie, które może zgłosić synchroniczna odpowiednik metody. Jeśli wyjątek jest przechowywany w zwróconym zadaniu, ten wyjątek zostanie zgłoszony, gdy zadanie będzie oczekiwać. Wyjątki użycia, takie jak ArgumentException, są nadal zgłaszane synchronicznie. Aby uzyskać informacje o przechowywanych wyjątkach, zobacz wyjątki zgłaszane przez program ExecuteDbDataReader(CommandBehavior).

Note

Ta metoda korzysta z ExecuteReaderAsync(CancellationToken)metody , a wszystkie oczekiwane wyjątki tej metody również mają zastosowanie tutaj.

Dotyczy