ObjectContext.Refresh Method
Refreshes cache data with store data for a specific entity.
Assembly: EntityFramework (in EntityFramework.dll)
Name | Description | |
---|---|---|
![]() | Refresh(RefreshMode, IEnumerable) | Updates a collection of objects in the object context with data from the database. |
![]() | Refresh(RefreshMode, Object) | Updates an object in the object context with data from the database. |
ObjectContext.Refresh Method (RefreshMode, IEnumerable)
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. |
ObjectContext.Refresh Method (RefreshMode, Object)
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. |