IDbCommandInterceptor.ReaderExecutingAsync Metoda

Definicja

Nazwana tuż przed tym, jak EF zamierza wywołać metodę ExecuteReaderAsync().

public System.Threading.Tasks.Task<Microsoft.EntityFrameworkCore.Diagnostics.InterceptionResult<System.Data.Common.DbDataReader>> ReaderExecutingAsync (System.Data.Common.DbCommand command, Microsoft.EntityFrameworkCore.Diagnostics.CommandEventData eventData, Microsoft.EntityFrameworkCore.Diagnostics.InterceptionResult<System.Data.Common.DbDataReader> result, System.Threading.CancellationToken cancellationToken = default);
public System.Threading.Tasks.ValueTask<Microsoft.EntityFrameworkCore.Diagnostics.InterceptionResult<System.Data.Common.DbDataReader>> ReaderExecutingAsync (System.Data.Common.DbCommand command, Microsoft.EntityFrameworkCore.Diagnostics.CommandEventData eventData, Microsoft.EntityFrameworkCore.Diagnostics.InterceptionResult<System.Data.Common.DbDataReader> result, System.Threading.CancellationToken cancellationToken = default);
public virtual System.Threading.Tasks.ValueTask<Microsoft.EntityFrameworkCore.Diagnostics.InterceptionResult<System.Data.Common.DbDataReader>> ReaderExecutingAsync (System.Data.Common.DbCommand command, Microsoft.EntityFrameworkCore.Diagnostics.CommandEventData eventData, Microsoft.EntityFrameworkCore.Diagnostics.InterceptionResult<System.Data.Common.DbDataReader> result, System.Threading.CancellationToken cancellationToken = default);
abstract member ReaderExecutingAsync : System.Data.Common.DbCommand * Microsoft.EntityFrameworkCore.Diagnostics.CommandEventData * Microsoft.EntityFrameworkCore.Diagnostics.InterceptionResult<System.Data.Common.DbDataReader> * System.Threading.CancellationToken -> System.Threading.Tasks.Task<Microsoft.EntityFrameworkCore.Diagnostics.InterceptionResult<System.Data.Common.DbDataReader>>
abstract member ReaderExecutingAsync : System.Data.Common.DbCommand * Microsoft.EntityFrameworkCore.Diagnostics.CommandEventData * Microsoft.EntityFrameworkCore.Diagnostics.InterceptionResult<System.Data.Common.DbDataReader> * System.Threading.CancellationToken -> System.Threading.Tasks.ValueTask<Microsoft.EntityFrameworkCore.Diagnostics.InterceptionResult<System.Data.Common.DbDataReader>>
abstract member ReaderExecutingAsync : System.Data.Common.DbCommand * Microsoft.EntityFrameworkCore.Diagnostics.CommandEventData * Microsoft.EntityFrameworkCore.Diagnostics.InterceptionResult<System.Data.Common.DbDataReader> * System.Threading.CancellationToken -> System.Threading.Tasks.ValueTask<Microsoft.EntityFrameworkCore.Diagnostics.InterceptionResult<System.Data.Common.DbDataReader>>
override this.ReaderExecutingAsync : System.Data.Common.DbCommand * Microsoft.EntityFrameworkCore.Diagnostics.CommandEventData * Microsoft.EntityFrameworkCore.Diagnostics.InterceptionResult<System.Data.Common.DbDataReader> * System.Threading.CancellationToken -> System.Threading.Tasks.ValueTask<Microsoft.EntityFrameworkCore.Diagnostics.InterceptionResult<System.Data.Common.DbDataReader>>
Public Function ReaderExecutingAsync (command As DbCommand, eventData As CommandEventData, result As InterceptionResult(Of DbDataReader), Optional cancellationToken As CancellationToken = Nothing) As Task(Of InterceptionResult(Of DbDataReader))
Public Function ReaderExecutingAsync (command As DbCommand, eventData As CommandEventData, result As InterceptionResult(Of DbDataReader), Optional cancellationToken As CancellationToken = Nothing) As ValueTask(Of InterceptionResult(Of DbDataReader))
Public Overridable Function ReaderExecutingAsync (command As DbCommand, eventData As CommandEventData, result As InterceptionResult(Of DbDataReader), Optional cancellationToken As CancellationToken = Nothing) As ValueTask(Of InterceptionResult(Of DbDataReader))

Parametry

command
DbCommand

Polecenie.

eventData
CommandEventData

Kontekstowe informacje o poleceniu i wykonaniu.

result
InterceptionResult<DbDataReader>

Reprezentuje bieżący wynik, jeśli istnieje. Ta wartość będzie miała HasResult ustawioną wartość true , jeśli jakiś poprzedni przechwytujący pominął wykonywanie przez wywołanie metody SuppressWithResult(TResult). Ta wartość jest zwykle używana jako wartość zwracana dla implementacji tej metody.

cancellationToken
CancellationToken

Element CancellationToken do obserwowania podczas oczekiwania na ukończenie zadania.

Zwraca

Jeśli HasResult jest to fałsz, ef będzie nadal działać normalnie. Jeśli HasResult ma wartość true, program EF pominie operację, która miała wykonać i użyć Result . Implementacja tej metody dla dowolnego przechwytnika, który nie próbuje zmienić wyniku, jest zwracanie przekazanej result wartości, często przy użyciu FromResult<TResult>(TResult)

Wyjątki

Jeśli element CancellationToken zostanie anulowany.

Dotyczy