ObjectContext.RefreshAsync Method
Asynchronously refreshes cache data with store data for specific entities.
Assembly: EntityFramework (in EntityFramework.dll)
Name | Description | |
---|---|---|
![]() | RefreshAsync(RefreshMode, IEnumerable) | Asynchronously updates a collection of objects in the object context with data from the database. |
![]() | RefreshAsync(RefreshMode, IEnumerable, CancellationToken) | Asynchronously updates a collection of objects in the object context with data from the database. |
![]() | RefreshAsync(RefreshMode, Object) | Asynchronously updates an object in the object context with data from the database. |
![]() | RefreshAsync(RefreshMode, Object, CancellationToken) | Asynchronously updates an object in the object context with data from the database. |
ObjectContext.RefreshAsync Method (RefreshMode, IEnumerable)
Asynchronously updates a collection of objects in the object context with data from the database.
Parameters
- refreshMode
-
Type:
System.Data.Entity.Core.Objects.RefreshMode
A RefreshMode value that indicates whether property changes in the object context are overwritten with property values from the database.
- collection
-
Type:
System.Collections.IEnumerable
An IEnumerable collection of objects to refresh.
Exception | Condition |
---|---|
ArgumentNullException | collection is null. |
ArgumentOutOfRangeException | refreshMode is not valid. |
ArgumentException | collection is empty or an object is not attached to the context. |
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.
ObjectContext.RefreshAsync Method (RefreshMode, IEnumerable, CancellationToken)
Asynchronously updates a collection of objects in the object context with data from the database.
public virtual Task RefreshAsync( RefreshMode refreshMode, IEnumerable collection, CancellationToken cancellationToken )
Parameters
- refreshMode
-
Type:
System.Data.Entity.Core.Objects.RefreshMode
A RefreshMode value that indicates whether property changes in the object context are overwritten with property values from the database.
- collection
-
Type:
System.Collections.IEnumerable
An IEnumerable collection of objects to refresh.
- cancellationToken
-
Type:
System.Threading.CancellationToken
A CancellationToken to observe while waiting for the task to complete.
Exception | Condition |
---|---|
ArgumentNullException | collection is null. |
ArgumentOutOfRangeException | refreshMode is not valid. |
ArgumentException | collection is empty or an object is not attached to the context. |
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.
ObjectContext.RefreshAsync Method (RefreshMode, Object)
Asynchronously updates an object in the object context with data from the database.
Parameters
- refreshMode
-
Type:
System.Data.Entity.Core.Objects.RefreshMode
A RefreshMode value that indicates whether property changes in the object context are overwritten with property values from the database.
- entity
-
Type:
System.Object
The object to be refreshed.
Exception | Condition |
---|---|
ArgumentNullException | entity is null. |
ArgumentOutOfRangeException | refreshMode is not valid. |
ArgumentException | entity is not attached to the context. |
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.
ObjectContext.RefreshAsync Method (RefreshMode, Object, CancellationToken)
Asynchronously updates an object in the object context with data from the database.
public virtual Task RefreshAsync( RefreshMode refreshMode, object entity, CancellationToken cancellationToken )
Parameters
- refreshMode
-
Type:
System.Data.Entity.Core.Objects.RefreshMode
A RefreshMode value that indicates whether property changes in the object context are overwritten with property values from the database.
- entity
-
Type:
System.Object
The object to be refreshed.
- cancellationToken
-
Type:
System.Threading.CancellationToken
A CancellationToken to observe while waiting for the task to complete.
Exception | Condition |
---|---|
ArgumentNullException | entity is null. |
ArgumentOutOfRangeException | refreshMode is not valid. |
ArgumentException | entity is not attached to the context. |
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.