共用方式為


DbInterception 類別

定義

這是攔截器的登錄點 IDbInterceptor 。 當 EF 執行特定作業時,攔截器會收到通知,例如針對資料庫執行命令。 如需範例,請參閱 IDbCommandInterceptor

public static class DbInterception
type DbInterception = class
Public Class DbInterception
繼承
DbInterception

屬性

Dispatch

這是分派至攔截器的進入點。 這通常僅供 Entity Framework 在內部使用,但會公開提供,讓其他程式碼可以確保代表 EF 執行作業時,會呼叫已註冊的攔截器。 例如,EF 提供者在執行命令時,可能會使用此提供者。

方法

Add(IDbInterceptor)

註冊新的 IDbInterceptor 以接收通知。 請注意,攔截器必須實作一些從 IDbInterceptor 延伸為有用的介面。

Remove(IDbInterceptor)

移除已註冊 IDbInterceptor 的 ,使其不再收到通知。 如果未註冊指定的攔截器,則這是無作業。

適用於