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

-或-

所附加的对象处于 AddedDeleted 状态。

注解

该方法 ValidateEntityForAttach<TEntity> 在附加操作期间由对象服务调用。

适用于