Condividi tramite


IDbCommandInterceptor.NonQueryExecutedAsync Metodo

Definizione

Chiamato immediatamente dopo che EF chiama ExecuteNonQueryAsync().

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

Parametri

command
DbCommand

Comando.

eventData
CommandExecutedEventData

Informazioni contestuali sul comando e sull'esecuzione.

result
Int32

Risultato della chiamata a ExecuteNonQueryAsync(). 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 ef userà. 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

Commenti

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

Si applica a