共用方式為


DbCommandInterceptor.ReaderExecuting 方法

定義

在 EF 想要呼叫 之前呼叫 ExecuteReader()

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

參數

command
DbCommand

命令。

eventData
CommandEventData

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

result
InterceptionResult<DbDataReader>

如果存在,則表示目前的結果。 如果某些先前的攔截器藉由呼叫 SuppressWithResult(TResult) 來隱藏執行,這個值將會 HasResult 設定為 true 。 這個值通常用來做為這個方法實作的傳回值。

傳回

如果 HasResult 為 false,EF 會如常繼續。 如果 HasResult 為 true,EF 將會隱藏即將執行的作業,並改為使用 Result 。 任何未嘗試變更結果的攔截器,這個方法的一般實作是傳回 result 傳入的值,通常使用 FromResult<TResult>(TResult)

實作

適用於