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>.

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.

.NET Framework
Available since 3.5
Return to top
Show: