ObjectContext.SaveChangesAsync Method

 

Asynchronously persists all updates to the store.

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

NameDescription
System_CAPS_pubmethodSaveChangesAsync()

Asynchronously persists all updates to the database and resets change tracking in the object context.

System_CAPS_pubmethodSaveChangesAsync(CancellationToken)

Asynchronously persists all updates to the database and resets change tracking in the object context.

System_CAPS_pubmethodSaveChangesAsync(SaveOptions)

Asynchronously persists all updates to the database and optionally resets change tracking in the object context.

System_CAPS_pubmethodSaveChangesAsync(SaveOptions, CancellationToken)

Asynchronously persists all updates to the database and optionally resets change tracking in the object context.


ObjectContext.SaveChangesAsync Method ()

Asynchronously persists all updates to the database and resets change tracking in the object context.

public virtual Task<int> SaveChangesAsync()

Return Value

Type: System.Threading.Tasks.Task<Int32>

A task that represents the asynchronous operation. The task result contains the number of objects in an Added, Modified, or Deleted state when SaveChanges was called.

Exception Condition
OptimisticConcurrencyException

An optimistic concurrency violation has occurred while saving changes.

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.SaveChangesAsync Method (CancellationToken)

Asynchronously persists all updates to the database and resets change tracking in the object context.

public virtual Task<int> SaveChangesAsync(
	CancellationToken cancellationToken
)

Parameters

cancellationToken
Type: System.Threading.CancellationToken

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

Return Value

Type: System.Threading.Tasks.Task<Int32>

A task that represents the asynchronous operation. The task result contains the number of objects in an Added, Modified, or Deleted state when SaveChanges was called.

Exception Condition
OptimisticConcurrencyException

An optimistic concurrency violation has occurred while saving changes.

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.SaveChangesAsync Method (SaveOptions)

Asynchronously persists all updates to the database and optionally resets change tracking in the object context.

public virtual Task<int> SaveChangesAsync(
	SaveOptions options
)

Parameters

options
Type: System.Data.Entity.Core.Objects.SaveOptions

A SaveOptions value that determines the behavior of the operation.

Return Value

Type: System.Threading.Tasks.Task<Int32>

A task that represents the asynchronous operation. The task result contains the number of objects in an Added, Modified, or Deleted state when SaveChanges was called.

Exception Condition
OptimisticConcurrencyException

An optimistic concurrency violation has occurred while saving changes.

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.SaveChangesAsync Method (SaveOptions, CancellationToken)

Asynchronously persists all updates to the database and optionally resets change tracking in the object context.

public virtual Task<int> SaveChangesAsync(
	SaveOptions options,
	CancellationToken cancellationToken
)

Parameters

options
Type: System.Data.Entity.Core.Objects.SaveOptions

A SaveOptions value that determines the behavior of the operation.

cancellationToken
Type: System.Threading.CancellationToken

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

Return Value

Type: System.Threading.Tasks.Task<Int32>

A task that represents the asynchronous operation. The task result contains the number of objects in an Added, Modified, or Deleted state when SaveChanges was called.

Exception Condition
OptimisticConcurrencyException

An optimistic concurrency violation has occurred while saving changes.

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.