Επεξεργασία

Κοινή χρήση μέσω


RelatedEnd.ValidateLoad<TEntity>(MergeOption, String) Method

Definition

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

protected:
generic <typename TEntity>
 System::Data::Objects::ObjectQuery<TEntity> ^ ValidateLoad(System::Data::Objects::MergeOption mergeOption, System::String ^ relatedEndName);
protected System.Data.Objects.ObjectQuery<TEntity> ValidateLoad<TEntity> (System.Data.Objects.MergeOption mergeOption, string relatedEndName);
member this.ValidateLoad : System.Data.Objects.MergeOption * string -> System.Data.Objects.ObjectQuery<'Entity>
Protected Function ValidateLoad(Of TEntity) (mergeOption As MergeOption, relatedEndName As String) As ObjectQuery(Of TEntity)

Type Parameters

TEntity

The type of the object to validate.

Parameters

mergeOption
MergeOption

The MergeOption to use when merging objects into an existing EntityCollection<TEntity>.

relatedEndName
String

The name of the related end.

Returns

ObjectQuery<TEntity>

An ObjectQuery<T> that is used to load the object or objects at the related end.

Exceptions

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

-or-

When the source object is not attached to the ObjectContext.

-or-

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

Remarks

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.

Applies to