Share via


RelatedEnd.LoadAsync Method

Definition

Overloads

LoadAsync(CancellationToken)

Asynchronously loads the related object or objects into the related end with the default merge option.

LoadAsync(MergeOption, CancellationToken)

Asynchronously loads an object or objects from the related end with the specified merge option.

LoadAsync(CancellationToken)

Asynchronously loads the related object or objects into the related end with the default merge option.

public System.Threading.Tasks.Task LoadAsync (System.Threading.CancellationToken cancellationToken);
abstract member LoadAsync : System.Threading.CancellationToken -> System.Threading.Tasks.Task
override this.LoadAsync : System.Threading.CancellationToken -> System.Threading.Tasks.Task

Parameters

cancellationToken
CancellationToken

A CancellationToken to observe while waiting for the task to complete.

Returns

A task that represents the asynchronous operation.

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

Multiple active operations on the same context instance are not supported. Use 'await' to ensure that any asynchronous operations have completed before calling another method on this context.

Applies to

LoadAsync(MergeOption, CancellationToken)

Asynchronously loads an object or objects from the related end with the specified merge option.

public abstract System.Threading.Tasks.Task LoadAsync (System.Data.Entity.Core.Objects.MergeOption mergeOption, System.Threading.CancellationToken cancellationToken);
abstract member LoadAsync : System.Data.Entity.Core.Objects.MergeOption * System.Threading.CancellationToken -> System.Threading.Tasks.Task

Parameters

mergeOption
MergeOption

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

cancellationToken
CancellationToken

A CancellationToken to observe while waiting for the task to complete.

Returns

A task that represents the asynchronous operation.

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

Multiple active operations on the same context instance are not supported. Use 'await' to ensure that any asynchronous operations have completed before calling another method on this context.

Applies to