語言

DbCommandInterceptor.ScalarExecuting 方法

定義

在 EF 準備打電話 ExecuteScalar()之前打了電話。

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

參數

command
DbCommand

命令。

eventData
CommandEventData

關於指令與執行的上下文資訊。

result
InterceptionResult<Object>

代表目前的結果(若存在)。 若先前攔截器透過呼叫 SuppressWithResult(TResult)抑制執行,則該值將設HasResult為 。true 此值通常用作此方法實作的回傳值。

傳回

若 HasResult 為假,EF 將照常進行。 若 HasResult 為真,EF 將抑制即將執行的操作並改用 Result 。 對於任何不嘗試更改結果的攔截器,這種方法的正常實作是回傳 result 傳入的值,通常使用 FromResult<TResult>(TResult)

實作

適用於