ObjectContext.SaveChanges Method
Persists all updates to the store.
Assembly: EntityFramework (in EntityFramework.dll)
Name | Description | |
---|---|---|
![]() | SaveChanges() | Persists all updates to the database and resets change tracking in the object context. |
![]() | SaveChanges(Boolean) | Obsolete.Persists all updates to the database and optionally resets change tracking in the object context. |
![]() | SaveChanges(SaveOptions) | Persists all updates to the database and optionally resets change tracking in the object context. |
ObjectContext.SaveChanges Method ()
Persists all updates to the database and resets change tracking in the object context.
Return Value
Type: System.Int32The 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. |
ObjectContext.SaveChanges Method (Boolean)
Note: This API is now obsolete.Persists all updates to the database and optionally resets change tracking in the object context.
[EditorBrowsableAttribute(EditorBrowsableState.Never)] [BrowsableAttribute(false)] [ObsoleteAttribute("Use SaveChanges(SaveOptions options) instead.")] public virtual int SaveChanges( bool acceptChangesDuringSave )
Parameters
- acceptChangesDuringSave
-
Type:
System.Boolean
This parameter is needed for client-side transaction support. If true, the change tracking on all objects is reset after SaveChanges finishes. If false, you must call the AcceptAllChanges method after SaveChanges.
Return Value
Type: System.Int32The 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. |
ObjectContext.SaveChanges Method (SaveOptions)
Persists all updates to the database and optionally resets change tracking in the object context.
Parameters
- options
-
Type:
System.Data.Entity.Core.Objects.SaveOptions
A SaveOptions value that determines the behavior of the operation.
Return Value
Type: System.Int32The 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. |