RelatedEnd::Load Method (MergeOption)
When overridden in a derived class, loads an object or objects from the related end with the specified merge option.
Assembly: System.Data.Entity (in System.Data.Entity.dll)
Parameters
- mergeOption
-
Type:
System.Data.Objects::MergeOption
The MergeOption to use when merging objects into an existing EntityCollection<TEntity>.
Implements
IRelatedEnd::Load(MergeOption)| Exception | Condition |
|---|---|
| InvalidOperationException | 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. |
Both EntityCollection<TEntity> and EntityReference<TEntity> override this method to load related objects. Load is called to explicitly load related objects from a related end exposed by a navigation property. For more information, see Loading Related Objects.
Calling the Load method sets the IsLoaded flag to true.
The Load method loads related objects from the data source whether or not IsLoaded is true.
The default merge option is AppendOnly for tracked objects or NoTracking when the object is not tracked in the ObjectStateManager.
Available since 3.5