共用方式為


IDbCommandInterceptor.ScalarExecuted 方法

定義

在 EF 呼叫 之後立即呼叫 ExecuteScalar()

public object ScalarExecuted (System.Data.Common.DbCommand command, Microsoft.EntityFrameworkCore.Diagnostics.CommandExecutedEventData eventData, object result);
public object? ScalarExecuted (System.Data.Common.DbCommand command, Microsoft.EntityFrameworkCore.Diagnostics.CommandExecutedEventData eventData, object? result);
public virtual object? ScalarExecuted (System.Data.Common.DbCommand command, Microsoft.EntityFrameworkCore.Diagnostics.CommandExecutedEventData eventData, object? result);
abstract member ScalarExecuted : System.Data.Common.DbCommand * Microsoft.EntityFrameworkCore.Diagnostics.CommandExecutedEventData * obj -> obj
abstract member ScalarExecuted : System.Data.Common.DbCommand * Microsoft.EntityFrameworkCore.Diagnostics.CommandExecutedEventData * obj -> obj
override this.ScalarExecuted : System.Data.Common.DbCommand * Microsoft.EntityFrameworkCore.Diagnostics.CommandExecutedEventData * obj -> obj
Public Function ScalarExecuted (command As DbCommand, eventData As CommandExecutedEventData, result As Object) As Object
Public Overridable Function ScalarExecuted (command As DbCommand, eventData As CommandExecutedEventData, result As Object) As Object

參數

command
DbCommand

命令。

eventData
CommandExecutedEventData

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

result
Object

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

傳回

EF 將使用的結果。 任何未嘗試變更結果之攔截器的這個方法實作是傳回 result 傳入的值。

備註

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

適用於