Editare

Partajați prin


RelatedEnd.Load Method

Definition

When overridden in a derived class, loads the related object or objects into the local collection or reference.

Overloads

Load()

When overridden in a derived class, loads the related object or objects into the related end with the default merge option.

Load(MergeOption)

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

Load()

When overridden in a derived class, loads the related object or objects into the related end with the default merge option.

public:
 virtual void Load();
public void Load ();
abstract member Load : unit -> unit
override this.Load : unit -> unit
Public Sub Load ()

Implements

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

The default merge option is AppendOnly for tracked objects or NoTracking when the object is not tracked in the ObjectStateManager. To specify a merge option other than AppendOnly, call the Load method on the EntityCollection<TEntity> or the EntityReference<TEntity> that takes a specific MergeOption parameter.

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.

Applies to

Load(MergeOption)

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

public:
 abstract void Load(System::Data::Objects::MergeOption mergeOption);
public abstract void Load (System.Data.Objects.MergeOption mergeOption);
abstract member Load : System.Data.Objects.MergeOption -> unit
Public MustOverride Sub Load (mergeOption As MergeOption)

Parameters

mergeOption
MergeOption

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

Implements

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

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.

Applies to