Merge Changes when Two Users Edit the Same Record Simultaneously

XAF Team Blog
16 May 2013

In multi-user data-aware applications, there are times when one user edits a record while another user is editing the same record. As long as the changes being made do not affect the same field (e.g., one user modifies the task description while another user attaches a file), XAF can resolve the situation, and merge simultaneous changes made by different users. Refer to the Concepts > Business Model Design > Business Model Design with XPO > Optimistic Concurrency Control help topic for more details.

To try out this functionality (which will be available in version 13.1 of XAF), add the following code to your Program.cs file.

static void Main() {
DevExpress.Xpo.XpoDefault.TrackPropertiesModifications = true;
// ...
}
 
Note that ASP.NET applications are not supported, because user interaction dialogs are currently only implemented for WinForms. The core helper classes are located in the DevExpress.ExpressApp.Xpo assembly so that support for ASP.NET can be added in the future.
 

Important note:

To support this functionality, persistent properties should be implemented in a specific manner. If you implement your business model in code, then follow XPO best practices and use either the SetPropertyValue or OnChanged method in persistent property setters. These methods have several overloads. Use the overloads that take both the old and new property values:

SetPropertyValue("PropertyName", ref propertyValueHolder, value);
 
OnChanged("PropertyName", propertyValueHolder, value)


If you use the Data Model Designer or Business Object Designer to create the data model, then you do not need to worry about implementing persistent properties. Designers automatically declare persistent properties in the proper manner.
 
If you have any questions about this functionality, feel free to leave a comment below.

Free DevExpress Products - Get Your Copy Today

The following free DevExpress product offers remain available. Should you have any questions about the free offers below, please submit a ticket via the DevExpress Support Center at your convenience. We'll be happy to follow-up.
Tags
No Comments

Please login or register to post comments.