Concurrency is critical in any multiuser environment where data is to be updated. Concurrency, as you can see in Figure 14.1, is best thought of as "multiple users vying to update data without affecting each other as they update it." In this illustration, each client application (Client A, Web Client B, and Web Client C) has read the same Customer data values at approximately the same time. They all see the same Customer data, and some will choose to update this data and expect their updates to be successful. The type of concurrency model you utilize will directly determine how these data resources are treated (held/locked/enqueued), what type of performance to expect, and how scalable your application will be.
In the classic client/server architectures, most programming languages and database servers support multiple types of concurrency models such as optimistic, pessimistic, and everything in between (different isolation levels). In the multitiered .NET architecture, the focus is on utilizing a "disconnected" mode of data retrieval to minimize data concurrency issues and to increase scalability. This correlates well with using the optimistic concurrency approach.
In this hour, you will learn about the following topics:
An overview of optimistic versus pessimistic concurrency
What's happening at the data provider level
How to use data in the DataSet to compare against what's in the database before updates are done
Utilizing a timestamp approach if available
Using the DataAdapter.RowUpdated event in conjunction with some of these approaches
How DiffGram s and XML handle optimistic concurrency