Share via


ObjectContext.RefreshAsync Method

Definition

Overloads

RefreshAsync(RefreshMode, IEnumerable)

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, IEnumerable, CancellationToken)

Asynchronously updates a collection of objects 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.

RefreshAsync(RefreshMode, IEnumerable)

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

public System.Threading.Tasks.Task RefreshAsync (System.Data.Entity.Core.Objects.RefreshMode refreshMode, System.Collections.IEnumerable collection);
member this.RefreshAsync : System.Data.Entity.Core.Objects.RefreshMode * System.Collections.IEnumerable -> System.Threading.Tasks.Task

Parameters

refreshMode
RefreshMode

A RefreshMode value that indicates whether property changes in the object context are overwritten with property values from the database.

collection
IEnumerable

An IEnumerable collection of objects to refresh.

Returns

A task that represents the asynchronous operation.

Exceptions

collection is null.

refreshMode is not valid.

collection is empty or an object is not attached to the context.

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

RefreshAsync(RefreshMode, Object)

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

public System.Threading.Tasks.Task RefreshAsync (System.Data.Entity.Core.Objects.RefreshMode refreshMode, object entity);
member this.RefreshAsync : System.Data.Entity.Core.Objects.RefreshMode * obj -> System.Threading.Tasks.Task

Parameters

refreshMode
RefreshMode

A RefreshMode value that indicates whether property changes in the object context are overwritten with property values from the database.

entity
Object

The object to be refreshed.

Returns

A task that represents the asynchronous operation.

Exceptions

entity is null.

refreshMode is not valid.

entity is not attached to the context.

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

RefreshAsync(RefreshMode, IEnumerable, CancellationToken)

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

public virtual System.Threading.Tasks.Task RefreshAsync (System.Data.Entity.Core.Objects.RefreshMode refreshMode, System.Collections.IEnumerable collection, System.Threading.CancellationToken cancellationToken);
abstract member RefreshAsync : System.Data.Entity.Core.Objects.RefreshMode * System.Collections.IEnumerable * System.Threading.CancellationToken -> System.Threading.Tasks.Task
override this.RefreshAsync : System.Data.Entity.Core.Objects.RefreshMode * System.Collections.IEnumerable * System.Threading.CancellationToken -> System.Threading.Tasks.Task

Parameters

refreshMode
RefreshMode

A RefreshMode value that indicates whether property changes in the object context are overwritten with property values from the database.

collection
IEnumerable

An IEnumerable collection of objects to refresh.

cancellationToken
CancellationToken

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

Returns

A task that represents the asynchronous operation.

Exceptions

collection is null.

refreshMode is not valid.

collection is empty or an object is not attached to the context.

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

RefreshAsync(RefreshMode, Object, CancellationToken)

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

public virtual System.Threading.Tasks.Task RefreshAsync (System.Data.Entity.Core.Objects.RefreshMode refreshMode, object entity, System.Threading.CancellationToken cancellationToken);
abstract member RefreshAsync : System.Data.Entity.Core.Objects.RefreshMode * obj * System.Threading.CancellationToken -> System.Threading.Tasks.Task
override this.RefreshAsync : System.Data.Entity.Core.Objects.RefreshMode * obj * System.Threading.CancellationToken -> System.Threading.Tasks.Task

Parameters

refreshMode
RefreshMode

A RefreshMode value that indicates whether property changes in the object context are overwritten with property values from the database.

entity
Object

The object to be refreshed.

cancellationToken
CancellationToken

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

Returns

A task that represents the asynchronous operation.

Exceptions

entity is null.

refreshMode is not valid.

entity is not attached to the context.

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