RelatedEnd.Load 方法

定义

在派生类中重写时,将一个或多个相关对象加载到本地集合或引用中。When overridden in a derived class, loads the related object or objects into the local collection or reference.

重载

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 ()

实现

例外

使用 NoTracking 查询来检索源对象并且 MergeOption 不是 NoTracking 或相关对象已经加载时。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-

源对象未附加到 ObjectContext 时。When the source object is not attached to the ObjectContext.

- 或 --or-

正在跟踪源对象但其处于 AddedDeleted 状态,或者用于 MergeOptionLoad()NoTracking 时。When the source object is being tracked but is in the Added or Deleted state or the MergeOption used for Load() is NoTracking.

注解

对于被跟踪的对象,默认合并选项为 AppendOnly。或者,当对象没有在 NoTracking 中跟踪时,默认选项为 ObjectStateManagerThe default merge option is AppendOnly for tracked objects or NoTracking when the object is not tracked in the ObjectStateManager. 若要指定之外的合并选项 AppendOnly ,请对使用 Load EntityCollection<TEntity> 特定参数的或调用方法 EntityReference<TEntity> MergeOptionTo 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.

调用 Load 方法会将 IsLoaded 标志设置为 trueCalling the Load method sets the IsLoaded flag to true.

Load无论是否为,方法都从数据源加载相关对象 IsLoaded trueThe Load method loads related objects from the data source whether or not IsLoaded is true.

适用于

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)

参数

mergeOption
MergeOption

将对象合并到现有 MergeOption 时使用的 EntityCollection<TEntity>The MergeOption to use when merging objects into an existing EntityCollection<TEntity>.

实现

例外

使用 NoTracking 查询来检索源对象并且 MergeOption 不是 NoTracking 或相关对象已经加载时。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-

源对象未附加到 ObjectContext 时。When the source object is not attached to the ObjectContext.

- 或 --or-

正在跟踪源对象但其处于 AddedDeleted 状态,或者用于 MergeOptionLoad()NoTracking 时。When the source object is being tracked but is in the Added or Deleted state or the MergeOption used for Load() is NoTracking.

注解

EntityCollection<TEntity>EntityReference<TEntity> 都重写此方法以加载相关对象。Both EntityCollection<TEntity> and EntityReference<TEntity> override this method to load related objects. Load 调用以从导航属性公开的相关端中显式加载相关对象。Load is called to explicitly load related objects from a related end exposed by a navigation property. 有关详细信息,请参阅 加载相关对象For more information, see Loading Related Objects.

调用 Load 方法会将 IsLoaded 标志设置为 trueCalling the Load method sets the IsLoaded flag to true.

Load无论是否为,方法都从数据源加载相关对象 IsLoaded trueThe Load method loads related objects from the data source whether or not IsLoaded is true.

对于被跟踪的对象,默认合并选项为 AppendOnly。或者,当对象没有在 NoTracking 中跟踪时,默认选项为 ObjectStateManagerThe default merge option is AppendOnly for tracked objects or NoTracking when the object is not tracked in the ObjectStateManager.

适用于