ObjectContext.RefreshAsync Method

 

Asynchronously refreshes cache data with store data for specific entities.

Namespace:   System.Data.Entity.Core.Objects
Assembly:  EntityFramework (in EntityFramework.dll)

NameDescription
System_CAPS_pubmethodRefreshAsync(RefreshMode, IEnumerable)

Asynchronously updates a collection of objects in the object context with data from the database.

System_CAPS_pubmethodRefreshAsync(RefreshMode, IEnumerable, CancellationToken)

Asynchronously updates a collection of objects in the object context with data from the database.

System_CAPS_pubmethodRefreshAsync(RefreshMode, Object)

Asynchronously updates an object in the object context with data from the database.

System_CAPS_pubmethodRefreshAsync(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.

public Task RefreshAsync(
	RefreshMode refreshMode,
	IEnumerable collection
)

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.

Return Value

Type: System.Threading.Tasks.Task

A task that represents the asynchronous operation.

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.

Return Value

Type: System.Threading.Tasks.Task

A task that represents the asynchronous operation.

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.

public Task RefreshAsync(
	RefreshMode refreshMode,
	object entity
)

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.

Return Value

Type: System.Threading.Tasks.Task

A task that represents the asynchronous operation.

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.

Return Value

Type: System.Threading.Tasks.Task

A task that represents the asynchronous operation.

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.