Share via


DbInterceptionContext Class

Definition

Represents contextual information associated with calls into IDbInterceptor implementations.

public class DbInterceptionContext
type DbInterceptionContext = class
Public Class DbInterceptionContext
Inheritance
DbInterceptionContext
Derived

Remarks

Note that specific types/operations that can be intercepted may use a more specific interception context derived from this class. For example, if SQL is being executed by a DbContext, then the DbContext will be contained in the DbCommandInterceptionContext<TResult> instance that is passed to the methods of IDbCommandInterceptor. Instances of this class are publicly immutable for contextual information. To add contextual information use one of the With... or As... methods to create a new interception context containing the new information.

Constructors

DbInterceptionContext()

Constructs a new DbInterceptionContext with no state.

DbInterceptionContext(DbInterceptionContext)

Creates a new DbInterceptionContext by copying state from the given interception context. See Clone()

Properties

DbContexts

Gets all the DbContext instances associated with this interception context.

IsAsync

True if the operation is being executed asynchronously, otherwise false.

ObjectContexts

Gets all the ObjectContext instances associated with this interception context.

Methods

AsAsync()

Creates a new DbInterceptionContext that contains all the contextual information in this interception context the IsAsync flag set to true.

Clone()

Call this method when creating a copy of an interception context in order to add new state to it. Using this method instead of calling the constructor directly ensures virtual dispatch so that the new type will have the same type (and any specialized state) as the context that is being cloned.

Equals(Object)

Determines whether the specified object is equal to the current object.

GetHashCode()

Serves as the default hash function.

GetType()

Gets the Type of the current instance.

ToString()

Returns a string that represents the current object.

WithDbContext(DbContext)

Creates a new DbInterceptionContext that contains all the contextual information in this interception context with the addition of the given DbContext.

WithObjectContext(ObjectContext)

Creates a new DbInterceptionContext that contains all the contextual information in this interception context with the addition of the given ObjectContext.

Applies to