ObjectContext.SaveChanges Method (SaveOptions)
Persists all updates to the data source with the specified SaveOptions.
Assembly: System.Data.Entity (in System.Data.Entity.dll)
'Declaration Public Overridable Function SaveChanges ( _ options As SaveOptions _ ) As Integer
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 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2