Q
Problem solve Get help with specific problems with your technologies, process and projects.

Managing C# concurrency problems: C# .NET database applications

What is the best approach for managing concurrency problems in C# .NET database applications? Any rules of thumb I should know about?

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, and using optimistic concurrency whenever you can. The traditional 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.

Dig Deeper on C# programming language

Have a question for an expert?

Please add a title for your question

Get answers from a TechTarget expert on whatever's puzzling you.

You will be able to add details on the next page.

Start the conversation

Send me notifications when other members comment.

Please create a username to comment.

-ADS BY GOOGLE

SearchCloudComputing

SearchSoftwareQuality

TheServerSide.com

Close