共用方式為


RelationshipManager.Create 方法

[此頁面專屬於 Entity Framework 第 6 版。最新版本可從 'Entity Framework' NuGet 套件取得。如需 Entity Framework 的詳細資訊,請參閱 msdn.com/data/ef。]

建立新的 RelationshipManager 物件。

命名空間:  System.Data.Entity.Core.Objects.DataClasses
組件:  EntityFramework (在 EntityFramework.dll 中)

語法

'宣告
Public Shared Function Create ( _
    owner As IEntityWithRelationships _
) As RelationshipManager
'用途
Dim owner As IEntityWithRelationships 
Dim returnValue As RelationshipManager 

returnValue = RelationshipManager.Create(owner)
public static RelationshipManager Create(
    IEntityWithRelationships owner
)
public:
static RelationshipManager^ Create(
    IEntityWithRelationships^ owner
)
static member Create : 
        owner:IEntityWithRelationships -> RelationshipManager
public static function Create(
    owner : IEntityWithRelationships
) : RelationshipManager

參數

傳回值

類型:System.Data.Entity.Core.Objects.DataClasses.RelationshipManager
要求的 RelationshipManager

備註

支援關聯性的資料類別所使用。 如果變更追蹤程式要求 RelationshipManager 屬性,而資料類別尚未擁有其中一個物件的參考,則會呼叫此方法建立參考,然後儲存該物件的參考。 後續存取該屬性時,資料類別應該會傳回儲存的參考。 使用 Factory 方法而不使用公用建構函式的原因,在於強調這不是您通常會在資料類別之外呼叫的項目。 透過要求透過此方法建立這些物件,開發人員應該會再三思考此作業,而一般只有在明確需要取得此類型物件時才會使用此方法。 這樣有助於定義預期的用法。

請參閱

參考

RelationshipManager 類別

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