DbCommandInterceptor.ReaderExecuting 方法
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
在 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 為假,EF 將照常進行。
若 HasResult 為真,EF 將抑制即將執行的操作並改用 Result 。
對於任何不嘗試更改結果的攔截器,這種方法的正常實作是回傳 result 傳入的值,通常使用 FromResult<TResult>(TResult)