Sdílet prostřednictvím


IDbCommandInterceptor.ScalarExecutedAsync Metoda

Definice

Volá se okamžitě po volání 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

Příkaz.

eventData
CommandExecutedEventData

Kontextové informace o příkazu a spuštění.

result
Object

Výsledek volání příkazu ExecuteScalarAsync(). Tato hodnota se obvykle používá jako návratová hodnota pro implementaci této metody.

cancellationToken
CancellationToken

A CancellationToken , která se má sledovat při čekání na dokončení úkolu.

Návraty

Poskytnutí Task výsledku, který ef použije. Implementace této metody pro jakýkoli zasahovač, který se nepokouší změnit výsledek, je vrátit předanou result hodnotu. Často se používá FromResult<TResult>(TResult)

Výjimky

Poznámky

Tato metoda se stále volá, pokud zachytávání potlačilo provádění příkazu v ScalarExecutingAsync(DbCommand, CommandEventData, InterceptionResult<Object>, CancellationToken). V tomto případě result je výsledek vrácený nástrojem ScalarExecutingAsync(DbCommand, CommandEventData, InterceptionResult<Object>, CancellationToken).

Platí pro