ObjectContext.SaveChanges Method (SaveOptions)
Persists all updates to the data source with the specified SaveOptions.
Assembly: System.Data.Entity (in System.Data.Entity.dll)
abstract SaveChanges : options:SaveOptions -> int override SaveChanges : options:SaveOptions -> int
An optimistic concurrency violation has occurred.
Use this specific overload of SaveChanges to either make sure that DetectChanges is called before you save changes to the data source or that AcceptAllChanges is called after you save changes to the data source.
This enumeration has a FlagsAttribute that allows for a bitwise combination of its member values.
To make sure that objects on the client have been updated by data source-side logic, you can call the Refresh method with the StoreWins value after you call SaveChanges. The SaveChanges method operates in a transaction. SaveChanges will roll back that transaction and throw an exception if any one of the dirty ObjectStateEntry objects cannot be persisted.
If an optimistic concurrency violation has occurred, an OptimisticConcurrencyException is thrown. You can resolve an optimistic concurrency violation by catching it, calling the Refresh method with the StoreWins or ClientWins values, and then calling the SaveChanges method again. For more information, see How to: Manage Data Concurrency in the Object Context (Entity Framework).
Windows 8.1, Windows Server 2012 R2, Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)
The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.