DbCommandInterceptor.NonQueryExecutedAsync Method

Definition

Called immediately after EF calls ExecuteNonQueryAsync().

This method is still called if an interceptor suppressed execution of a command in NonQueryExecutingAsync(DbCommand, CommandEventData, InterceptionResult<Int32>, CancellationToken). In this case, result is the result returned by NonQueryExecutingAsync(DbCommand, CommandEventData, InterceptionResult<Int32>, CancellationToken).

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

Parameters

command
DbCommand

The command.

eventData
CommandExecutedEventData

Contextual information about the command and execution.

result
Int32

The result of the call to ExecuteNonQueryAsync(). This value is typically used as the return value for the implementation of this method.

cancellationToken
CancellationToken

A CancellationToken to observe while waiting for the task to complete.

Returns

A Task providing the result that EF will use. A normal implementation of this method for any interceptor that is not attempting to change the result is to return the result value passed in, often using FromResult<TResult>(TResult)

Implements

Exceptions

Applies to