Managing concurrency problems in C# .NET database applications |
 |
EXPERT RESPONSE FROM: Daniel Cazzulino

|
 |
|


|
| > |
QUESTION POSED ON: 22 July 2004
What is the best approach for managing concurrency problems in C# .NET database applications? Any rules of thumb I should know about?
|
|
|
To continue reading for free, register below or login
To read more you must become a member of SearchWinDevelopment.com
');
// -->

Generally, if you're going to perform operations on multiple databases/servers, you must use Enterprise Services (i.e. your classes inheriting from ServicedComponent). If you're working against a single database, try using manual transactions, or some approach like the one in CodeProject (http://codeproject.com/dotnet/declarativetransactions.asp), and using optimistic concurrency whenever you can. The tradicional way of doing this is retrieving timestamps for the rows you're using, and then comparing these timestamps with the current ones on the database. If they don't match, someone else's modified it, and you usually show the user both the actual values and his proposed changes, and let him chose which ones should prevail.
|
|
|

|
|
 |

 |
 |
Search and Browse the Expert Answer Center
Search and browse more than 25,000 question and
answer pairs from more than 250 TechTarget industry experts.
|
 |
 |
 |
|
 |
 |
 |
|
 |
|
 |