RelatedEnd.ValidateEntityForAttach<TEntity> Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Determines whether an object can be attached to the local collection or reference.
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)
Type Parameters
- TEntity
The type of the object to validate.
Parameters
- entity
- TEntity
The object being validated.
- index
- Int32
The position of the object being validated in the collection.
- allowCollection
- Boolean
Indicates whether the object is a member of a collection.
Exceptions
When the object being attached is null
.
-or-
The object being attached to the related end does not exist in the same ObjectContext as the source object.
-or-
Remarks
The ValidateEntityForAttach<TEntity>
method is called by Object Services during an attach operation.