ObjectDataSource.ConflictDetection 属性

定义

获取或设置一个值,该值确定是仅将新值传递给 Update 方法,还是将旧值和新值都传递给 Update 方法。Gets or sets a value that determines whether or not just the new values are passed to the Update method or both the old and new values are passed to the Update method.

public:
 property System::Web::UI::ConflictOptions ConflictDetection { System::Web::UI::ConflictOptions get(); void set(System::Web::UI::ConflictOptions value); };
public System.Web.UI.ConflictOptions ConflictDetection { get; set; }
member this.ConflictDetection : System.Web.UI.ConflictOptions with get, set
Public Property ConflictDetection As ConflictOptions

属性值

ConflictOptions 值之一。One of the ConflictOptions values. 默认值为 OverwriteChangesThe default is OverwriteChanges.

注解

此属性确定是否将旧值和新值的参数应用于UpdateMethod属性指定的方法。This property determines whether parameters for old and new values are applied to the method specified by the UpdateMethod property. 例如, SelectMethod如果属性指定的方法返回一个DataTable具有列NameNumber的控件, 并且该ConflictDetection属性设置为OverwriteChanges字段, 则会为指定的参数Name方法和NumberUpdateFor example, if the method that is specified by the SelectMethod property returns a DataTable control with the columns Name and Number, and the ConflictDetection property is set to the OverwriteChanges field, parameters are created for Name and Number for the Update method. CompareAllValues Name Number original_Number如果将original_Name属性设置为值, 则会为、、和创建参数。 ConflictDetectionIf the ConflictDetection property is set to the CompareAllValues value, parameters are created for Name, Number, original_Name, and original_Number. (原始值的参数的准确名称取决于OldValuesParameterFormatString属性。)然后确定UpdateMethod属性中指定的方法是否具有匹配的参数。 ObjectDataSource(The exact name of the parameters for the original values depends on the OldValuesParameterFormatString property.) The ObjectDataSource then determines whether the method that is specified in the UpdateMethod property has parameters that match.

并发控制是一种技术, 当多个客户端访问和操作相同数据时, 数据存储使用该技术来控制如何在存储区中读取和更改数据。Concurrency control is a technique that data stores use to control how data is read and changed in the store when multiple clients are accessing and manipulating the same data. 例如, 一个客户端读取数据并向用户显示数据, 而另一个客户端读取相同的数据并将其显示给其他用户。For example, one client reads data and presents it to a user, while another client reads the same data and presents it to a different user. 如果这两个用户更新数据并将其提交到数据存储, 则可能会出现意外的结果, 因为这两个客户端可能会为同一数据提供不同的值。If both users update the data and submit it to the data storage, an unexpected result might occur, because both clients might provide different values for the same data. 这被视为冲突。This is considered a conflict. 通过将ConflictDetection属性设置CompareAllValues为值, 该Update方法可以将旧值和新值与原始数据源进行比较, 以检测冲突并根据需要对其进行处理。By setting the ConflictDetection property to the CompareAllValues value, the Update method can then compare the old and new values to the original data source to detect conflicts and handle them as necessary.

属性委托ObjectDataSourceView ConflictDetection给与ObjectDataSource控件相关联的对象的属性。 ConflictDetectionThe ConflictDetection property delegates to the ConflictDetection property of the ObjectDataSourceView object that is associated with the ObjectDataSource control.

适用于

另请参阅