DbConfiguration.AddInterceptor(IDbInterceptor) 方法
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
從衍生出 DbConfiguration 的類別建構子呼叫此方法,以註冊應用程式 IDbInterceptor 啟動時的 。 請注意,攔截器也可以隨時使用。DbInterception
protected internal void AddInterceptor(System.Data.Entity.Infrastructure.Interception.IDbInterceptor interceptor);
member this.AddInterceptor : System.Data.Entity.Infrastructure.Interception.IDbInterceptor -> unit
Protected Friend Sub AddInterceptor (interceptor As IDbInterceptor)
參數
- interceptor
- IDbInterceptor
攔截機要註冊。
備註
此方法作為一種方便且易於發現的方式,為實體框架添加配置。 內部運作方式與使用 AddDependencyResolver 為 新增合適的解析器 IDbInterceptor相同。 這表示如果需要,也可以使用自訂解析器或由控制反轉容器支援的解析器來達成相同的功能。