Dec 8 2006

Concurrency in ADO.NET

Category: ASP.NET 1.xBil@l @ 14:27

During my reading to the Microsoft ADO.NET Core Reference by David Sceppa I am getting to learn so many things, among which ways to handle concurrency Options:

1- Include only the Primary Key Columns
This way, when User A and User B both read the same record at the same time, when it comes for updating the record, the last who updates wins, since no way to update a primary key!

2- Include All Columns in the WHERE clause
This way, first one to update the record wins! The second who had the same version of the record at the same time will fail to update.

3- Include Primary Key and Timestamp Columns
This way, only the first one wins the update, but in this case few checkings will be done in the WHERE clause, only the primary key(s) and a timestamp column.

4- Include the Primary Key Columns and Modified Columns
This is not recommended, because you as a developer should provide a different stored procedure for each updatable column.

Hope this helps!



Comments are closed