SaveChangesOptions SaveChangesOptions SaveChangesOptions SaveChangesOptions Enum

定义

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

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

public enum class SaveChangesOptions
[System.Flags]
public enum SaveChangesOptions
type SaveChangesOptions = 
Public Enum SaveChangesOptions
继承
SaveChangesOptionsSaveChangesOptionsSaveChangesOptionsSaveChangesOptions
属性

字段

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.

当未使用批处理时, DataServiceResponse.BatchHeaders属性将返回一个空集合, DataServiceResponse.BatchStatusCode并且属性为零。When batching is not used, the DataServiceResponse.BatchHeaders property returns an empty collection, and the DataServiceResponse.BatchStatusCode property is zero.

您不能同时设置 BatchContinueOnErrorYou cannot set both Batch and ContinueOnError at the same time.

适用于

另请参阅