RelatedEnd.ValidateEntityForAttach<TEntity> 方法

定義

判斷物件是否能附加到本地集合或參考中。

protected public:
generic <typename TEntity>
 void ValidateEntityForAttach(TEntity entity, int index, bool allowCollection);
protected internal void ValidateEntityForAttach<TEntity>(TEntity entity, int index, bool allowCollection);
member this.ValidateEntityForAttach : 'Entity * int * bool -> unit
Protected Friend Sub ValidateEntityForAttach(Of TEntity) (entity As TEntity, index As Integer, allowCollection As Boolean)

類型參數

TEntity

要驗證的物件類型。

參數

entity
TEntity

被驗證的物件。

index
Int32

被驗證物件在集合中的位置。

allowCollection
Boolean

表示該物件是否屬於集合。

例外狀況

當所附著的物體為 null時。

-或-

連接在相關端端的物件與來源物件並不存在於同一 ObjectContext 狀態。

-或-

被附著的物體處於 Added or Deleted 狀態。

備註

ValidateEntityForAttach<TEntity>此方法由物件服務在連接操作中呼叫。

適用於