Managing Concurrency

The Entity Framework uses an optimistic concurrency model by default. In this case, optimistic means that we cross our fingers and hope that we don't get overlapping page requests that lead to conflicting data changes. One request leads to a change to the data and updates the database. A moment later, the second request leads to a different change to the same data and performs an update. When the second update is applied, the original changes are lost, and because the first request has completed, we have no way to signal to the users that their modifications have been overwritten.

We can partially address this problem by enabling concurrency checking on individual fields in the data model. This is still optimistic concurrency, ...

Get Applied ASP.NET 4 in Context now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.