ObjectContext.SaveChanges Method (Boolean)


The .NET API Reference documentation has a new home. Visit the .NET API Browser on docs.microsoft.com to see the new experience.

obsoleteCodeEntityM:System.Data.Objects.ObjectContext.SaveChanges(System.Data.Objects.SaveOptions)Note: This API is now obsolete.

Persists all updates to the data source and optionally resets change tracking in the object context.

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

[ObsoleteAttribute("Use SaveChanges(SaveOptions options) instead.")]
public int SaveChanges(
	bool 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(Boolean) finishes. If false, you must call the AcceptAllChanges method after SaveChanges(Boolean).

Return Value

Type: System.Int32

The number of objects in an Added, Modified, or Deleted state when SaveChanges was called.

Exception Condition

An optimistic concurrency violation has occurred.

Call the SaveChanges(SaveOptions) method instead.

.NET Framework
Available since 3.5
Return to top