Pages

Subscribe:

Ads 468x60px

Wednesday, 7 September 2011

6 ways of doing locking in .NET (Pessimistic and optimistic)


Introduction

This article talks about 6 ways of doing locking in .NET. It starts with concurrency problems and then discusses about 3 ways of doing optimistic locking. As optimistic locking does not solve the concurrency issues from roots, it introduces pessimistic locking. It then moves ahead to explain how isolation levels can help us implement pessimistic locking. Each isolation level is explained with sample demonstration to make concepts clearer.

This is a small Ebook for all my .NET friends which covers topics like WCF,WPF,WWF,Ajax,Core .NET,SQL, Entity framework, Design patterns , Agile etc you can download the same from here  or else you can catch me on my daily free training @ from here

Why do we need locking?

In multi-user environment it's possible that multiple users can update the same record at the same time causing confusion between users. This issue is termed as concurrency.
1a.JPG

How can we solve concurrency problems?

Concurrency problems can be solved by implementing proper "Locking strategy". Locks prevent action on a resource to be performed when some other resource is already performing some action on it.

0 comments:

Post a Comment