Condividi tramite


DbCommandInterceptor.ScalarExecutedAsync Metodo

Definizione

Chiamato immediatamente dopo le chiamate ExecuteScalarAsync()EF .

Questo metodo viene ancora chiamato se un intercettatore ha eliminato l'esecuzione di un comando in ScalarExecutingAsync(DbCommand, CommandEventData, InterceptionResult<Object>, CancellationToken). In questo caso, result è il risultato restituito da ScalarExecutingAsync(DbCommand, CommandEventData, InterceptionResult<Object>, CancellationToken).

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

Parametri

command
DbCommand

Comando.

eventData
CommandExecutedEventData

Informazioni contestuali sul comando e sull'esecuzione.

result
Object

Risultato della chiamata a ExecuteScalarAsync(). Questo valore viene in genere usato come valore restituito per l'implementazione di questo metodo.

cancellationToken
CancellationToken

Oggetto CancellationToken da osservare durante l'attesa del completamento dell'attività.

Restituisce

Oggetto Task che fornisce il risultato che verrà usato da EF. Una normale implementazione di questo metodo per qualsiasi intercettatore che non tenta di modificare il risultato consiste nel restituire il result valore passato, spesso usando FromResult<TResult>(TResult)

Implementazioni

Eccezioni

Si applica a