Udostępnij za pośrednictwem


IDbCommandInterceptor.ScalarExecutedAsync Metoda

Definicja

Wywołana natychmiast po wywołaniu programu ExecuteScalarAsync()EF .

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

Parametry

command
DbCommand

Polecenie.

eventData
CommandExecutedEventData

Kontekstowe informacje o poleceniu i wykonaniu.

result
Object

Wynik wywołania metody ExecuteScalarAsync(). 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

Wynik Task , który będzie używany przez platformę EF. Implementacja tej metody dla każdego przechwytnika, który nie próbuje zmienić wyniku, jest zwrócenie result wartości przekazanej, często przy użyciu FromResult<TResult>(TResult)

Wyjątki

Jeśli element CancellationToken zostanie anulowany.

Uwagi

Ta metoda jest nadal wywoływana, jeśli interceptor pomija wykonywanie polecenia w programie ScalarExecutingAsync(DbCommand, CommandEventData, InterceptionResult<Object>, CancellationToken). W tym przypadku result wynik jest zwracany przez ScalarExecutingAsync(DbCommand, CommandEventData, InterceptionResult<Object>, CancellationToken).

Dotyczy