語言

DbCommandInterceptor.CommandCreating 方法

定義

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

public virtual Microsoft.EntityFrameworkCore.Diagnostics.InterceptionResult<System.Data.Common.DbCommand> CommandCreating(Microsoft.EntityFrameworkCore.Diagnostics.CommandCorrelatedEventData eventData, Microsoft.EntityFrameworkCore.Diagnostics.InterceptionResult<System.Data.Common.DbCommand> result);
abstract member CommandCreating : Microsoft.EntityFrameworkCore.Diagnostics.CommandCorrelatedEventData * Microsoft.EntityFrameworkCore.Diagnostics.InterceptionResult<System.Data.Common.DbCommand> -> Microsoft.EntityFrameworkCore.Diagnostics.InterceptionResult<System.Data.Common.DbCommand>
override this.CommandCreating : Microsoft.EntityFrameworkCore.Diagnostics.CommandCorrelatedEventData * Microsoft.EntityFrameworkCore.Diagnostics.InterceptionResult<System.Data.Common.DbCommand> -> Microsoft.EntityFrameworkCore.Diagnostics.InterceptionResult<System.Data.Common.DbCommand>
Public Overridable Function CommandCreating (eventData As CommandCorrelatedEventData, result As InterceptionResult(Of DbCommand)) As InterceptionResult(Of DbCommand)

參數

eventData
CommandCorrelatedEventData

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

result
InterceptionResult<DbCommand>

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

傳回

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

實作

適用於