TransactionHandler.MatchesParentContext 方法
[本页针对的是实体框架版本 6。最新版本以“实体框架”NuGet 包的形式提供。有关实体框架的更多信息,请参见 msdn.com/data/ef。]
检查提供的侦听上下文是否包含目标上下文,或提供的连接与目标上下文使用的连接相同。
命名空间: System.Data.Entity.Infrastructure
程序集: EntityFramework(在 EntityFramework.dll 中)
语法
声明
Protected Friend Overridable Function MatchesParentContext ( _
connection As DbConnection, _
interceptionContext As DbInterceptionContext _
) As Boolean
用法
Dim connection As DbConnection
Dim interceptionContext As DbInterceptionContext
Dim returnValue As Boolean
returnValue = Me.MatchesParentContext(connection, _
interceptionContext)
protected internal virtual bool MatchesParentContext(
DbConnection connection,
DbInterceptionContext interceptionContext
)
protected public:
virtual bool MatchesParentContext(
DbConnection^ connection,
DbInterceptionContext^ interceptionContext
)
abstract MatchesParentContext :
connection:DbConnection *
interceptionContext:DbInterceptionContext -> bool
override MatchesParentContext :
connection:DbConnection *
interceptionContext:DbInterceptionContext -> bool
function MatchesParentContext(
connection : DbConnection,
interceptionContext : DbInterceptionContext
) : boolean
参数
- connection
类型:System.Data.Common.DbConnection
连接。
- interceptionContext
类型:DbInterceptionContext
侦听上下文。
返回值
类型:System.Boolean
如果提供的侦听上下文包含目标上下文或者在提供的侦听上下文不包含任何上下文时提供的连接与目标上下文使用的连接相同,则为 true;否则为 false。
备注
请注意,调用此方法将触发从 interceptionContext 引用的任何 DbContext 的初始化