Compartir a través de


DbCommandInterceptor.ScalarExecutedAsync Método

Definición

Se llama inmediatamente después de que EF llame a ExecuteScalarAsync().

Se sigue llamando a este método si un interceptor suprimió la ejecución de un comando en ScalarExecutingAsync(DbCommand, CommandEventData, InterceptionResult<Object>, CancellationToken). En este caso, result es el resultado devuelto por 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)

Parámetros

command
DbCommand

El comando.

eventData
CommandExecutedEventData

Información contextual sobre el comando y la ejecución.

result
Object

Resultado de la llamada a ExecuteScalarAsync(). Este valor se usa normalmente como valor devuelto para la implementación de este método.

cancellationToken
CancellationToken

que CancellationToken se va a observar mientras espera a que se complete la tarea.

Devoluciones

Que Task proporciona el resultado que EF va a usar. Una implementación normal de este método para cualquier interceptor que no intente cambiar el resultado es devolver el result valor pasado, a menudo usando FromResult<TResult>(TResult)

Implementaciones

Excepciones

Se aplica a