Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All

RelatedEnd.Load Method (MergeOption)

When overridden in a derived class, loads an object or objects from the related end with the specified merge option.

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

public abstract void Load(
	MergeOption mergeOption
)

Parameters

mergeOption
Type: System.Data.Objects.MergeOption

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

Implements

IRelatedEnd.Load(MergeOption)

ExceptionCondition
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 Shaping Query Results (Entity Framework).

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.

.NET Framework

Supported in: 4.6, 4.5, 4, 3.5 SP1

.NET Framework Client Profile

Supported in: 4
Show:
© 2015 Microsoft