Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

How do you handle data concurrency in .NET ?

Answer Posted / ravikumar

When multiple users attempt to modify data at the same
time, controls need to be established in order to prevent
one user's modifications from adversely affecting
modifications from simultaneous users. The system of
handling what happens in this situation is called
concurrency control.

Types of Concurrency Control
In general, there are three common ways to manage
concurrency in a database:

Pessimistic concurrency control: A row is unavailable to
users from the time the record is fetched until it is
updated in the database.

Optimistic concurrency control: A row is unavailable to
other users only while the data is actually being updated.
The update examines the row in the database and determines
whether any changes have been made. Attempting to update a
record that has already been changed results in a
concurrency violation.

"Last in wins": A row is unavailable to other users only
while the data is actually being updated. However, no
effort is made to compare updates against the original
record; the record is simply written out, potentially
overwriting any changes made by other users since you last
refreshed the records.

Pessimistic Concurrency
Pessimistic concurrency is typically used for two reasons.
First, in some situations there is high contention for the
same records. The cost of placing locks on the data is less
than the cost of rolling back changes when concurrency
conflicts occur.

Pessimistic concurrency is also useful for situations where
it is detrimental for the record to change during the
course of a transaction. A good example is an inventory
application. Consider a company representative checking
inventory for a potential customer. You typically want to
lock the record until an order is generated, which would
generally flag the item with a status of ordered and remove
it from available inventory. If no order is generated, the
lock would be released so that other users checking
inventory get an accurate count of available inventory.

However, pessimistic concurrency control is not possible in
a disconnected architecture. Connections are open only long
enough to read the data or to update it, so locks cannot be
sustained for long periods. Moreover, an application that
holds onto locks for long periods is not scalable.

Is This Answer Correct ?    12 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Which is faster datareader or dataadapter?

992


how to create a quiz software using 4 options to answer and how to check with answers in the database and award marks....

4456


Which method is used to sort the data in ADO.Net?

1978


Explain how to copy the contents from one table to another table and how to delete the source table in ado.net?

868


Which provider is used to connect ms access, oracle, etc…?

1003


Define table relations?

979


How to add an aggregate column?

1018


How can I retrieve two tables of data at a time by using data reader?

1019


Can we create Synonymns in MS Acess,My Sql Server,Sql Server? But iam we can create in oracle!

2142


What is a datagridview?

1044


What are three methods for displaying data in a syncfusion datagrid

1072


What is namespace in ado.net?

1021


What is connected architecture in ado.net?

1074


Explain ado.net features? Benefits? Drawbacks?

1052


Which is faster sqldataadapter and sqldatareader?

928