SaveChangesOptions SaveChangesOptions SaveChangesOptions SaveChangesOptions Enum


指示调用 SaveChanges() 时的更改选项。Indicates change options when SaveChanges() is called.

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

public enum class SaveChangesOptions
public enum SaveChangesOptions
type SaveChangesOptions = 
Public Enum SaveChangesOptions


Batch Batch Batch Batch 1

所有挂起的更改都保存在单个批处理请求中。All pending changes are saved in a single batch request.

ContinueOnError ContinueOnError ContinueOnError ContinueOnError 2

挂起的更改使用多个请求保存在服务器中,发生错误后操作继续。Pending changes are saved by using multiple requests to the server, and the operation continues after an error occurs.

None None None None 0

挂起的更改使用多个请求保存在服务器中,但在第一次失败后操作停止(默认)。Pending changes are saved by using multiple requests to the server, but the operation stops on the first failure (default).

ReplaceOnUpdate ReplaceOnUpdate ReplaceOnUpdate ReplaceOnUpdate 4

通过将数据源中实体的所有值替换为更新后的实体 (HTTP PUT) 的值,执行挂起的更新,而不是更新已更改的值 (HTTP MERGE),该值为默认行为。Pending updates are made by replacing all values of the entity in the data source with values from the updated entity (HTTP PUT) instead of just updating changed values (HTTP MERGE), which is the default behavior.


时设置了 ContinueOnError 选项,即使发生错误,也仍会尝试后续操作。When the ContinueOnError option is set, subsequent operations are still tried even after an error occurs.

当不使用批处理时,BatchHeaders 实例上的 BatchHeaders 属性将返回空集合,并且 BatchStatusCode 属性为零。When batching is not used, the BatchHeaders property on the BatchHeaders instance returns an empty collection and the BatchStatusCode property is zero.

不能在同一时间设置批处理和 continueonerror 特性。You cannot set both Batch and ContinueOnError at the same time.