Reputation: 2001
There is a table called Accounts.The table structure looks like:
AccountID AccountName AccountTotalMoney
1 Stsven 3000
The account(where AccountID=1) was shared by many users.
So when a user updates the account(locking the account),I would like to prevent others updating the account.
I have visited
6 ways of doing locking in .NET
But I do not understand yet.Sorry for my bad english. Thanks in advance!
Upvotes: 3
Views: 1027
Reputation: 147
You can use TransactionScope to implement pessimistic locking (change isolation level)
I think this post can help: Setting the IsolationLevel using the System.Transactions TransactionScope.
Be aware "pessimistic locking" mentioned in the link you posted is different concept of "pessimistic concurrency". Make sure it is the thing you want.
Upvotes: 2