IDbCommandInterceptor.ScalarExecutingAsync Metodo
Definizione
Importante
Alcune informazioni sono relative alla release non definitiva del prodotto, che potrebbe subire modifiche significative prima della release definitiva. Microsoft non riconosce alcuna garanzia, espressa o implicita, in merito alle informazioni qui fornite.
Chiamato subito prima che EF intenda chiamare ExecuteScalarAsync().
public 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 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);
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>>
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>>
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 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 Function ScalarExecutingAsync (command As DbCommand, eventData As CommandEventData, result As InterceptionResult(Of Object), Optional cancellationToken As CancellationToken = Nothing) As ValueTask(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))
Parametri
- command
- DbCommand
Comando.
- eventData
- CommandEventData
Informazioni contestuali sul comando e sull'esecuzione.
- result
- InterceptionResult<Object>
Rappresenta il risultato corrente, se presente.
Questo valore sarà HasResult impostato su true
se un precedente intercettore ha eliminato l'esecuzione chiamando SuppressWithResult(TResult).
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
Se HasResult è false, Entity Framework continuerà come di consueto.
Se HasResult è true, EF elimina invece l'operazione che sta per eseguire e usare Result .
Un'implementazione di questo metodo per qualsiasi intercettore che non tenta di modificare il risultato consiste nel restituire il result
valore passato, spesso usando FromResult<TResult>(TResult)
Eccezioni
Se CancellationToken viene annullato.