RelatedEnd.LoadAsync Method
Asynchronously loads the related entity or entities into the related end using the supplied merge option.
Assembly: EntityFramework (in EntityFramework.dll)
Name | Description | |
---|---|---|
![]() | 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. |
RelatedEnd.LoadAsync Method (CancellationToken)
Asynchronously loads the related object or objects into the related end with the default merge option.
Parameters
- cancellationToken
-
Type:
System.Threading.CancellationToken
A CancellationToken to observe while waiting for the task to complete.
Implements
IRelatedEnd.LoadAsync(CancellationToken)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. |
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.
RelatedEnd.LoadAsync Method (MergeOption, CancellationToken)
Asynchronously loads an object or objects from the related end with the specified merge option.
public abstract Task LoadAsync( MergeOption mergeOption, CancellationToken cancellationToken )
Parameters
- mergeOption
-
Type:
System.Data.Entity.Core.Objects.MergeOption
The MergeOption to use when merging objects into an existing EntityCollection<TEntity>.
- cancellationToken
-
Type:
System.Threading.CancellationToken
A CancellationToken to observe while waiting for the task to complete.
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. |
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.