TransactionHandler.MatchesParentContext 方法

定义

检查提供的拦截上下文是否包含目标上下文,或者提供的连接是否与目标上下文使用的连接相同。

protected internal virtual bool MatchesParentContext (System.Data.Common.DbConnection connection, System.Data.Entity.Infrastructure.Interception.DbInterceptionContext interceptionContext);
abstract member MatchesParentContext : System.Data.Common.DbConnection * System.Data.Entity.Infrastructure.Interception.DbInterceptionContext -> bool
override this.MatchesParentContext : System.Data.Common.DbConnection * System.Data.Entity.Infrastructure.Interception.DbInterceptionContext -> bool
Protected Friend Overridable Function MatchesParentContext (connection As DbConnection, interceptionContext As DbInterceptionContext) As Boolean

参数

connection
DbConnection

一个连接。

interceptionContext
DbInterceptionContext

拦截上下文。

返回

true 如果提供的拦截上下文包含目标上下文,或者如果提供的拦截上下文不包含任何上下文,则提供的连接与目标上下文使用的连接相同;如果提供的拦截上下文不包含任何上下文,则为 ; false 否则。

注解

请注意,调用此方法将触发从 引用的任何 DbContext 的初始化 interceptionContext

适用于