Share via


DbCommandInterceptionContext Class

Definition

Represents contextual information associated with calls into IDbCommandInterceptor implementations.

public class DbCommandInterceptionContext : System.Data.Entity.Infrastructure.Interception.DbInterceptionContext
type DbCommandInterceptionContext = class
    inherit DbInterceptionContext
Public Class DbCommandInterceptionContext
Inherits DbInterceptionContext
Inheritance
DbCommandInterceptionContext
Derived

Remarks

An instance of this class is passed to the dispatch methods of DbCommandDispatcher and does not contain mutable information such as the result of the operation. This mutable information is obtained from the DbCommandInterceptionContext<TResult> that is passed to the interceptors. Instances of this class are publicly immutable. To add contextual information use one of the With... or As... methods to create a new interception context containing the new information.

Constructors

DbCommandInterceptionContext()

Constructs a new DbCommandInterceptionContext with no state.

DbCommandInterceptionContext(DbInterceptionContext)

Creates a new DbCommandInterceptionContext by copying state from the given interception context. Also see Clone()

Properties

CommandBehavior

The CommandBehavior that will be used or has been used to execute the command with a DbDataReader. This property is only used for ExecuteReader(CommandBehavior) and its async counterparts.

DbContexts

Gets all the DbContext instances associated with this interception context.

(Inherited from DbInterceptionContext)
IsAsync

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

(Inherited from DbInterceptionContext)
ObjectContexts

Gets all the ObjectContext instances associated with this interception context.

(Inherited from DbInterceptionContext)

Methods

AsAsync()

Creates a new DbCommandInterceptionContext 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.

WithCommandBehavior(CommandBehavior)

Creates a new DbCommandInterceptionContext that contains all the contextual information in this interception context together with the given CommandBehavior.

WithDbContext(DbContext)

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

WithObjectContext(ObjectContext)

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

Applies to