RelationshipManager.Create(IEntityWithRelationships) 方法

定义

创建一个新的 RelationshipManager 对象。

public static System.Data.Entity.Core.Objects.DataClasses.RelationshipManager Create (System.Data.Entity.Core.Objects.DataClasses.IEntityWithRelationships owner);
static member Create : System.Data.Entity.Core.Objects.DataClasses.IEntityWithRelationships -> System.Data.Entity.Core.Objects.DataClasses.RelationshipManager
Public Shared Function Create (owner As IEntityWithRelationships) As RelationshipManager

参数

owner
IEntityWithRelationships

对调用此方法的实体的引用。

返回

请求的 RelationshipManager

注解

由支持关系的数据类使用。 如果更改跟踪器请求 RelationshipManager 属性,并且数据类还没有对这些对象之一的引用,它将调用此方法来创建一个,然后保存对该对象的引用。 在后续访问该属性时,数据类应返回保存的引用。 使用工厂方法而不是公共构造函数的原因是强调,这不是通常在数据类外部调用的内容。 通过要求通过此方法创建这些对象,开发人员应更多地考虑操作,并且通常仅在显式需要获取此类型的对象时才使用它。 它有助于定义预期用途。

适用于