共用方式為


IDbCommandInterceptor.NonQueryExecutedAsync 方法

定義

在 EF 呼叫 之後立即呼叫 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)

參數

command
DbCommand

命令。

eventData
CommandExecutedEventData

命令和執行的相關內容資訊。

result
Int32

呼叫 ExecuteNonQueryAsync() 的結果。 這個值通常用來做為這個方法實作的傳回值。

cancellationToken
CancellationToken

CancellationToken等候工作完成時要觀察的 。

傳回

Task 提供 EF 將使用的結果。 任何未嘗試變更結果的攔截器實作這個方法,就是傳回 result 傳入的值,通常使用 FromResult<TResult>(TResult)

例外狀況

備註

如果在 中 NonQueryExecutingAsync(DbCommand, CommandEventData, InterceptionResult<Int32>, CancellationToken) 隱藏命令的執行攔截器,仍會呼叫這個方法。 在此情況下, result 是 所 NonQueryExecutingAsync(DbCommand, CommandEventData, InterceptionResult<Int32>, CancellationToken) 傳回的結果。

適用於