Share via


DbConfiguration.AddInterceptor(IDbInterceptor) Method

Definition

Call this method from the constructor of a class derived from DbConfiguration to register an IDbInterceptor at application startup. Note that interceptors can also be added and removed at any time using 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)

Parameters

interceptor
IDbInterceptor

The interceptor to register.

Remarks

This method is provided as a convenient and discoverable way to add configuration to the Entity Framework. Internally it works in the same way as using AddDependencyResolver to add an appropriate resolver for IDbInterceptor. This means that, if desired, the same functionality can be achieved using a custom resolver or a resolver backed by an Inversion-of-Control container.

Applies to