SqlBatch.ExecuteDbDataReaderAsync(CommandBehavior, CancellationToken) Metodo
Definizione
Importante
Alcune informazioni sono relative alla release non definitiva del prodotto, che potrebbe subire modifiche significative prima della release definitiva. Microsoft non riconosce alcuna garanzia, espressa o implicita, in merito alle informazioni qui fornite.
Questa implementazione richiama il ExecuteReaderAsync() metodo e restituisce un'attività completata. L'implementazione predefinita restituirà un'attività annullata se è stato passato un token di annullamento già annullato. Questo metodo accetta un token di annullamento che può essere usato per richiedere l'annullamento anticipato dell'operazione.
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)
Parametri
- behavior
- CommandBehavior
Istanza di CommandBehavior, che specifica le opzioni per l'esecuzione batch e il recupero dei dati. Solo SequentialAccess e CloseConnection sono supportati a livello di batch.
- cancellationToken
- CancellationToken
Token per annullare l'operazione asincrona.
Valori restituiti
Attività che rappresenta l'operazione asincrona.
Eccezioni
Il token di annullamento è stato annullato. Questa eccezione viene archiviata nell'attività restituita.
Commenti
Per altre informazioni sulla programmazione asincrona, vedere Programmazione asincrona.
Questo metodo archivia nell'attività che restituisce tutte le eccezioni non di utilizzo che la controparte sincrona del metodo può generare. Se un'eccezione viene archiviata nell'attività restituita, tale eccezione verrà generata quando l'attività è attesa. Le eccezioni di utilizzo, ad esempio ArgumentException, vengono comunque generate in modo sincrono. Per le eccezioni archiviate, vedere le eccezioni generate da ExecuteDbDataReader(CommandBehavior).
Note
Questo metodo trae vantaggio da ExecuteReaderAsync(CancellationToken)e tutte le eccezioni previste di tale metodo si applicano qui.