共用方式為


RelatedEnd.IRelatedEnd.Attach 方法 (IEntityWithRelationships)

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

將實體附加至相關端。 此方法的運作方式與 Attach(object) 完全相同。 保留它的目的在於提供與舊版 IRelatedEnd 的回溯相容性。

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

語法

'宣告
<SuppressMessageAttribute("Microsoft.Design", "CA1033:InterfaceMethodsShouldBeCallableByChildTypes")> _
Private Sub Attach ( _
    entity As IEntityWithRelationships _
) Implements IRelatedEnd.Attach
'用途
Dim instance As RelatedEnd 
Dim entity As IEntityWithRelationships 

CType(instance, IRelatedEnd).Attach(entity)
[SuppressMessageAttribute("Microsoft.Design", "CA1033:InterfaceMethodsShouldBeCallableByChildTypes")]
void IRelatedEnd.Attach(
    IEntityWithRelationships entity
)
[SuppressMessageAttribute(L"Microsoft.Design", L"CA1033:InterfaceMethodsShouldBeCallableByChildTypes")]
private:
virtual void Attach(
    IEntityWithRelationships^ entity
) sealed = IRelatedEnd::Attach
[<SuppressMessageAttribute("Microsoft.Design", "CA1033:InterfaceMethodsShouldBeCallableByChildTypes")>]
private abstract Attach : 
        entity:IEntityWithRelationships -> unit 
[<SuppressMessageAttribute("Microsoft.Design", "CA1033:InterfaceMethodsShouldBeCallableByChildTypes")>]
private override Attach : 
        entity:IEntityWithRelationships -> unit
JScript supports the use of explicit interface implementations, but not the declarations of new ones.

參數

Implements

IRelatedEnd.Attach(IEntityWithRelationships)

例外狀況

例外狀況 條件
ArgumentNullException

當 entity 為 null 時擲回。

InvalidOperationException

當實體無法透過目前的關聯性端相關聯時擲回。

請參閱

參考

RelatedEnd 類別

Attach 多載

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