RelationshipManager 类

[本页针对的是实体框架版本 6。最新版本以“实体框架”NuGet 包的形式提供。有关实体框架的更多信息,请参见 msdn.com/data/ef。]

惰式创建的关系导航属性对象(集合和 ref)的容器。

继承层次结构

System.Object
  System.Data.Entity.Core.Objects.DataClasses.RelationshipManager

命名空间:  System.Data.Entity.Core.Objects.DataClasses
程序集:  EntityFramework(在 EntityFramework.dll 中)

语法

声明
<SerializableAttribute> _
<SuppressMessageAttribute("Microsoft.Maintainability", "CA1506:AvoidExcessiveClassCoupling")> _
Public Class RelationshipManager
用法
Dim instance As RelationshipManager
[SerializableAttribute]
[SuppressMessageAttribute("Microsoft.Maintainability", "CA1506:AvoidExcessiveClassCoupling")]
public class RelationshipManager
[SerializableAttribute]
[SuppressMessageAttribute(L"Microsoft.Maintainability", L"CA1506:AvoidExcessiveClassCoupling")]
public ref class RelationshipManager
[<SerializableAttribute>]
[<SuppressMessageAttribute("Microsoft.Maintainability", "CA1506:AvoidExcessiveClassCoupling")>]
type RelationshipManager =  class end
public class RelationshipManager

RelationshipManager 类型公开以下成员。

方法

  名称 描述
公共方法静态成员 Create 创建一个新的 RelationshipManager 对象。
公共方法 Equals (继承自 Object。)
受保护的方法 Finalize (继承自 Object。)
公共方法 GetAllRelatedEnds 返回关系管理器管理的所有相关端的枚举。
公共方法 GetHashCode (继承自 Object。)
公共方法 GetRelatedCollection<TTargetEntity> 获取具有指定关系名称和目标角色名称的相关对象的 EntityCollection<TEntity>
公共方法 GetRelatedEnd 为关系中的指定目标角色返回正确类型的 EntityCollection<TEntity>EntityReference<TEntity>
公共方法 GetRelatedReference<TTargetEntity> 通过使用关系名称和目标角色名称的指定组合,获取相关对象的 EntityReference<TEntity>
公共方法 GetType (继承自 Object。)
公共方法 InitializeRelatedCollection<TTargetEntity> 采用通过默认构造函数创建的现有 EntityCollection,并且使用提供的关系和目标角色名称初始化它。此方法设计为仅在反序列化期间使用;如果已初始化提供的 EntityCollection 或者关系管理器已附加到某一 ObjectContext,此方法将引发异常。
公共方法 InitializeRelatedReference<TTargetEntity> 采用通过默认构造函数创建的现有 EntityReference,并且使用提供的关系和目标角色名称初始化它。此方法设计为仅在反序列化期间使用;并且在以下情况下此方法将引发异常:已初始化提供的 EntityReference、关系管理器已包含具有此名称和目标角色的关系或者关系管理器已附加到某一 ObjectContext。
受保护的方法 MemberwiseClone (继承自 Object。)
公共方法 OnDeserialized 在内部使用,用于反序列化实体对象及 RelationshipManager 实例。
公共方法 OnSerializing 由对象服务调用,用来准备 EntityKey 以序列化关系进行二进制序列化。
公共方法 ToString (继承自 Object。)

顶部

线程安全

此类型的任何公共 static(在 Visual Basic 中为 Shared) 成员都是线程安全的。但不保证所有实例成员都是线程安全的。

请参阅

参考

System.Data.Entity.Core.Objects.DataClasses 命名空间