TransactionHandler.MatchesParentContext Method (DbConnection, DbInterceptionContext)

 

Checks whether the supplied interception context contains the target context or the supplied connection is the same as the one used by the target context.

Namespace:   System.Data.Entity.Infrastructure
Assembly:  EntityFramework (in EntityFramework.dll)

protected internal virtual bool MatchesParentContext(
	DbConnection connection,
	DbInterceptionContext interceptionContext
)

Parameters

connection
Type: System.Data.Common.DbConnection

A connection.

interceptionContext
Type: System.Data.Entity.Infrastructure.Interception.DbInterceptionContext

An interception context.

Return Value

Type: System.Boolean

true if the supplied interception context contains the target context or the supplied connection is the same as the one used by the target context if the supplied interception context doesn't contain any contexts; false otherwise.

Note that calling this method will trigger initialization of any DbContext referenced from the interceptionContext