Condividi tramite


DbCommandInterceptor.NonQueryExecutingAsync Metodo

Definizione

Chiamato subito prima che EF intenda chiamare ExecuteNonQueryAsync().

public virtual System.Threading.Tasks.Task<Microsoft.EntityFrameworkCore.Diagnostics.InterceptionResult<int>> NonQueryExecutingAsync (System.Data.Common.DbCommand command, Microsoft.EntityFrameworkCore.Diagnostics.CommandEventData eventData, Microsoft.EntityFrameworkCore.Diagnostics.InterceptionResult<int> result, System.Threading.CancellationToken cancellationToken = default);
public virtual System.Threading.Tasks.ValueTask<Microsoft.EntityFrameworkCore.Diagnostics.InterceptionResult<int>> NonQueryExecutingAsync (System.Data.Common.DbCommand command, Microsoft.EntityFrameworkCore.Diagnostics.CommandEventData eventData, Microsoft.EntityFrameworkCore.Diagnostics.InterceptionResult<int> result, System.Threading.CancellationToken cancellationToken = default);
abstract member NonQueryExecutingAsync : System.Data.Common.DbCommand * Microsoft.EntityFrameworkCore.Diagnostics.CommandEventData * Microsoft.EntityFrameworkCore.Diagnostics.InterceptionResult<int> * System.Threading.CancellationToken -> System.Threading.Tasks.Task<Microsoft.EntityFrameworkCore.Diagnostics.InterceptionResult<int>>
override this.NonQueryExecutingAsync : System.Data.Common.DbCommand * Microsoft.EntityFrameworkCore.Diagnostics.CommandEventData * Microsoft.EntityFrameworkCore.Diagnostics.InterceptionResult<int> * System.Threading.CancellationToken -> System.Threading.Tasks.Task<Microsoft.EntityFrameworkCore.Diagnostics.InterceptionResult<int>>
abstract member NonQueryExecutingAsync : System.Data.Common.DbCommand * Microsoft.EntityFrameworkCore.Diagnostics.CommandEventData * Microsoft.EntityFrameworkCore.Diagnostics.InterceptionResult<int> * System.Threading.CancellationToken -> System.Threading.Tasks.ValueTask<Microsoft.EntityFrameworkCore.Diagnostics.InterceptionResult<int>>
override this.NonQueryExecutingAsync : System.Data.Common.DbCommand * Microsoft.EntityFrameworkCore.Diagnostics.CommandEventData * Microsoft.EntityFrameworkCore.Diagnostics.InterceptionResult<int> * System.Threading.CancellationToken -> System.Threading.Tasks.ValueTask<Microsoft.EntityFrameworkCore.Diagnostics.InterceptionResult<int>>
Public Overridable Function NonQueryExecutingAsync (command As DbCommand, eventData As CommandEventData, result As InterceptionResult(Of Integer), Optional cancellationToken As CancellationToken = Nothing) As Task(Of InterceptionResult(Of Integer))
Public Overridable Function NonQueryExecutingAsync (command As DbCommand, eventData As CommandEventData, result As InterceptionResult(Of Integer), Optional cancellationToken As CancellationToken = Nothing) As ValueTask(Of InterceptionResult(Of Integer))

Parametri

command
DbCommand

Comando.

eventData
CommandEventData

Informazioni contestuali sul comando e sull'esecuzione.

result
InterceptionResult<Int32>

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 normale di questo metodo per qualsiasi intercettore che non tenta di modificare il risultato consiste nel restituire il result valore passato, spesso utilizzando FromResult<TResult>(TResult)

Implementazioni

Eccezioni

Si applica a