语言

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 的初始化

适用于