DbCommandInterceptor.ScalarExecutingAsync Método
Definição
Importante
Algumas informações se referem a produtos de pré-lançamento que podem ser substancialmente modificados antes do lançamento. A Microsoft não oferece garantias, expressas ou implícitas, das informações aqui fornecidas.
Chamado pouco antes do EF pretende chamar ExecuteScalarAsync().
public virtual System.Threading.Tasks.Task<Microsoft.EntityFrameworkCore.Diagnostics.InterceptionResult<object>> ScalarExecutingAsync (System.Data.Common.DbCommand command, Microsoft.EntityFrameworkCore.Diagnostics.CommandEventData eventData, Microsoft.EntityFrameworkCore.Diagnostics.InterceptionResult<object> result, System.Threading.CancellationToken cancellationToken = default);
public virtual System.Threading.Tasks.ValueTask<Microsoft.EntityFrameworkCore.Diagnostics.InterceptionResult<object>> ScalarExecutingAsync (System.Data.Common.DbCommand command, Microsoft.EntityFrameworkCore.Diagnostics.CommandEventData eventData, Microsoft.EntityFrameworkCore.Diagnostics.InterceptionResult<object> result, System.Threading.CancellationToken cancellationToken = default);
abstract member ScalarExecutingAsync : System.Data.Common.DbCommand * Microsoft.EntityFrameworkCore.Diagnostics.CommandEventData * Microsoft.EntityFrameworkCore.Diagnostics.InterceptionResult<obj> * System.Threading.CancellationToken -> System.Threading.Tasks.Task<Microsoft.EntityFrameworkCore.Diagnostics.InterceptionResult<obj>>
override this.ScalarExecutingAsync : System.Data.Common.DbCommand * Microsoft.EntityFrameworkCore.Diagnostics.CommandEventData * Microsoft.EntityFrameworkCore.Diagnostics.InterceptionResult<obj> * System.Threading.CancellationToken -> System.Threading.Tasks.Task<Microsoft.EntityFrameworkCore.Diagnostics.InterceptionResult<obj>>
abstract member ScalarExecutingAsync : System.Data.Common.DbCommand * Microsoft.EntityFrameworkCore.Diagnostics.CommandEventData * Microsoft.EntityFrameworkCore.Diagnostics.InterceptionResult<obj> * System.Threading.CancellationToken -> System.Threading.Tasks.ValueTask<Microsoft.EntityFrameworkCore.Diagnostics.InterceptionResult<obj>>
override this.ScalarExecutingAsync : System.Data.Common.DbCommand * Microsoft.EntityFrameworkCore.Diagnostics.CommandEventData * Microsoft.EntityFrameworkCore.Diagnostics.InterceptionResult<obj> * System.Threading.CancellationToken -> System.Threading.Tasks.ValueTask<Microsoft.EntityFrameworkCore.Diagnostics.InterceptionResult<obj>>
Public Overridable Function ScalarExecutingAsync (command As DbCommand, eventData As CommandEventData, result As InterceptionResult(Of Object), Optional cancellationToken As CancellationToken = Nothing) As Task(Of InterceptionResult(Of Object))
Public Overridable Function ScalarExecutingAsync (command As DbCommand, eventData As CommandEventData, result As InterceptionResult(Of Object), Optional cancellationToken As CancellationToken = Nothing) As ValueTask(Of InterceptionResult(Of Object))
Parâmetros
- command
- DbCommand
O comando.
- eventData
- CommandEventData
Informações contextuais sobre o comando e a execução.
- result
- InterceptionResult<Object>
Representa o resultado atual se houver um.
Esse valor terá HasResult definido como true
se algum interceptador anterior suprimiu a execução chamando SuppressWithResult(TResult).
Esse valor normalmente é usado como o valor retornado para a implementação desse método.
- cancellationToken
- CancellationToken
Um CancellationToken a ser observado enquanto aguarda a conclusão da tarefa.
Retornos
Se HasResult for false, o EF continuará normalmente.
Se HasResult for true, o EF suprimirá a operação que estava prestes a executar e usar Result .
Uma implementação normal desse método para qualquer interceptador que não esteja tentando alterar o resultado é retornar o result
valor passado, muitas vezes usando FromResult<TResult>(TResult)
Implementações
Exceções
Se o padrão CancellationToken for cancelado.
Aplica-se a
Entity Framework