DbContextOptionsBuilder.AddInterceptors Method

Definition

Overloads

AddInterceptors(IInterceptor[])

Adds IInterceptor instances to those registered on the context.

Interceptors can be used to view, change, or suppress operations taken by Entity Framework. See the specific implementations of IInterceptor for details. For example, 'IDbCommandInterceptor'.

Extensions can also register multiple IInterceptors in the internal service provider. If both injected and application interceptors are found, then the injected interceptors are run in the order that they are resolved from the service provider, and then the application interceptors are run in the order that they were added to the context.

Calling this method multiple times will result in all interceptors in every call being added to the context. Interceptors added in a previous call are not overridden by interceptors added in a later call.

AddInterceptors(IEnumerable<IInterceptor>)

Adds IInterceptor instances to those registered on the context.

Interceptors can be used to view, change, or suppress operations taken by Entity Framework. See the specific implementations of IInterceptor for details. For example, 'IDbCommandInterceptor'.

A single interceptor instance can implement multiple different interceptor interfaces. I will be registered as an interceptor for all interfaces that it implements.

Extensions can also register multiple IInterceptors in the internal service provider. If both injected and application interceptors are found, then the injected interceptors are run in the order that they are resolved from the service provider, and then the application interceptors are run in the order that they were added to the context.

Calling this method multiple times will result in all interceptors in every call being added to the context. Interceptors added in a previous call are not overridden by interceptors added in a later call.

AddInterceptors(IInterceptor[])

Adds IInterceptor instances to those registered on the context.

Interceptors can be used to view, change, or suppress operations taken by Entity Framework. See the specific implementations of IInterceptor for details. For example, 'IDbCommandInterceptor'.

Extensions can also register multiple IInterceptors in the internal service provider. If both injected and application interceptors are found, then the injected interceptors are run in the order that they are resolved from the service provider, and then the application interceptors are run in the order that they were added to the context.

Calling this method multiple times will result in all interceptors in every call being added to the context. Interceptors added in a previous call are not overridden by interceptors added in a later call.

public virtual Microsoft.EntityFrameworkCore.DbContextOptionsBuilder AddInterceptors (params Microsoft.EntityFrameworkCore.Diagnostics.IInterceptor[] interceptors);
abstract member AddInterceptors : Microsoft.EntityFrameworkCore.Diagnostics.IInterceptor[] -> Microsoft.EntityFrameworkCore.DbContextOptionsBuilder
override this.AddInterceptors : Microsoft.EntityFrameworkCore.Diagnostics.IInterceptor[] -> Microsoft.EntityFrameworkCore.DbContextOptionsBuilder
Public Overridable Function AddInterceptors (ParamArray interceptors As IInterceptor()) As DbContextOptionsBuilder

Parameters

interceptors
IInterceptor[]

The interceptors to add.

Returns

DbContextOptionsBuilder

The same builder instance so that multiple calls can be chained.

Applies to

AddInterceptors(IEnumerable<IInterceptor>)

Adds IInterceptor instances to those registered on the context.

Interceptors can be used to view, change, or suppress operations taken by Entity Framework. See the specific implementations of IInterceptor for details. For example, 'IDbCommandInterceptor'.

A single interceptor instance can implement multiple different interceptor interfaces. I will be registered as an interceptor for all interfaces that it implements.

Extensions can also register multiple IInterceptors in the internal service provider. If both injected and application interceptors are found, then the injected interceptors are run in the order that they are resolved from the service provider, and then the application interceptors are run in the order that they were added to the context.

Calling this method multiple times will result in all interceptors in every call being added to the context. Interceptors added in a previous call are not overridden by interceptors added in a later call.

public virtual Microsoft.EntityFrameworkCore.DbContextOptionsBuilder AddInterceptors (System.Collections.Generic.IEnumerable<Microsoft.EntityFrameworkCore.Diagnostics.IInterceptor> interceptors);
abstract member AddInterceptors : seq<Microsoft.EntityFrameworkCore.Diagnostics.IInterceptor> -> Microsoft.EntityFrameworkCore.DbContextOptionsBuilder
override this.AddInterceptors : seq<Microsoft.EntityFrameworkCore.Diagnostics.IInterceptor> -> Microsoft.EntityFrameworkCore.DbContextOptionsBuilder
Public Overridable Function AddInterceptors (interceptors As IEnumerable(Of IInterceptor)) As DbContextOptionsBuilder

Parameters

interceptors
IEnumerable<IInterceptor>

The interceptors to add.

Returns

DbContextOptionsBuilder

The same builder instance so that multiple calls can be chained.

Applies to