RelatedEnd.ValidateLoad<TEntity> Method

[This documentation is for preview only, and is subject to change in later releases. Blank topics are included as placeholders.]

Ensures that the related object or objects can be successfully loaded into the local collection or reference.

Namespace:  System.Data.Objects.DataClasses
Assembly:  System.Data.Entity (in System.Data.Entity.dll)

protected ObjectQuery<TEntity> ValidateLoad<TEntity>(
	MergeOption mergeOption,
	string relatedEndName

Type Parameters


The type of the object to validate.


Type: System.Data.Objects.MergeOption
The MergeOption to use when merging objects into an existing EntityCollection<TEntity>.
Type: System.String
The name of the related end.

Return Value

Type: System.Data.Objects.ObjectQuery<TEntity>
An ObjectQuery<T> that is used to load the object or objects at the related end.


When the source object was retrieved by using a NoTracking query and the MergeOption is not NoTracking or the related objects are already loaded.


When the source object is not attached to the ObjectContext.


When the source object is being tracked but is in the Added or Deleted state or the MergeOption used for Load is NoTracking.

Object Services obtains the ObjectQuery<T> by calling the IRelatedEnd.CreateSourceQuery method.

Object Services calls the ValidateLoad<TEntity> method before executing a load operation to ensure that the operation will succeed.

Windows 7, Windows Vista, Windows XP SP2, Windows Server 2008, Windows Server 2003

The .NET Framework and .NET Compact Framework do not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

.NET Framework

Supported in: 4, 3.5 SP1