Adding concurrency support
You may have noticed that in the section, Modifying UpdateProduct in the data access layer, we commented out a line of code about the RowVersion
in the ProductDAO.cs
file. This is because in our ProductEntity
class there is no property for RowVersion
. Concurrent updates are not supported by this service now. Next we will modify a few classes to add concurrent update control.
Turning on RowVersion concurrency mode
At the beginning of this chapter, when we added the Products
table to our entity data model, we didn't turn on concurrency mode for the RowVersion
column, even though its data type is timestamp
. We just changed the data access layer from ADO.NET to LINQ to Entities without concurrency control. Even if we had turned on concurrency mode for the RowVersion
column on the Entity data model at that time, we still wouldn't have concurrency control. We need to modify a few more classes to achieve concurrency control. In this section we will explain how to add concurrency...