A more complex but useful option, is to merge the client values and database values.
For each property: Later, when reader Writer3 reads the product, product has name and list price values updated by reader Wrtier1, and has subcategory updated by reader Writer2. Write method, a general Save Changes extension method for Db Context can be defined to handle concurrency conflicts and apply simple retry logic: To apply custom retry logic, Microsoft provides Enterprise Library.
This impedance mismatch is visible in multiple ways.
It is not a part of the object-relational mapping, so it has a [Not Mapped] attribute.
Also, the entity has a tracking state Modified after change saving is done.
So the safe approach is to reload and refresh the entity’s values and tracking information: Update Product is called with a resolve Conflicts function, which resolves the conflict by calling Reload method on the Entity Entry instance representing the conflicting product’s tracking information: Later, when reader Writer3 reads the product again, product has all values updated by reader Wrtier1. With this library, a Save Changes overload with customizable retry logic can be easily defined: Here Microsoft.
Similar to previous examples, the following example has multiple Db Reader Writer instances to update a product concurrently: As a result, the handle Exception function specified for read Writer2 is called, it retrieves the conflicting product’s tracking information from Db Update Concurrency Exception.
Entries, and logs these information: Then handle Exception calls resolve Conflicts function to actually resolve the conflict. Retry Policy executes the operation with the specified exception detection, exception handling, and retry logic.