SaveOptions SaveOptions SaveOptions SaveOptions Enum


指定在调用 SaveChanges(SaveOptions) 方法时对象上下文的行为。Specifies the behavior of the object context when the SaveChanges(SaveOptions) method is called.

此枚举有一个 FlagsAttribute 属性,允许按位组合成员值。

public enum class SaveOptions
public enum SaveOptions
type SaveOptions = 
Public Enum SaveOptions


AcceptAllChangesAfterSave AcceptAllChangesAfterSave AcceptAllChangesAfterSave AcceptAllChangesAfterSave 1

在保存更改后,调用 AcceptAllChangesAfterSave 方法,该方法会在 ObjectStateManager 中重置更改跟踪。After changes are saved, the AcceptAllChangesAfterSave method is called, which resets change tracking in the ObjectStateManager.

DetectChangesBeforeSave DetectChangesBeforeSave DetectChangesBeforeSave DetectChangesBeforeSave 2

在保存更改之前,调用 DetectChanges() 方法,使用 ObjectStateManager 中的数据同步附加到对象上下文的对象的属性值。Before changes are saved, the DetectChanges() method is called to synchronize the property values of objects that are attached to the object context with data in the ObjectStateManager.

None None None None 0

保存更改,不调用 DetectChanges()AcceptAllChangesAfterSave 方法。Changes are saved without the DetectChanges() or the AcceptAllChangesAfterSave methods being called.