The ADO.NET Object Model

The goal of ADO.NET is to provide a bridge between your objects in ASP.NET and your back-end database. ADO.NET provides an object-oriented view into the database, encapsulating many of the database properties and relationships within ADO.NET objects. Further, and in many ways most important, the ADO.NET objects encapsulate and hide the details of database access; your objects can interact with ADO.NET objects without you knowing or worrying about the details of how the data is moved to and from the database.

An overview of the ADO.NET architecture is shown in Figure 10-1. We will return to the aspects of this figure throughout the chapter.

ADO.NET architecture diagram

Figure 10-1. ADO.NET architecture diagram

The DataSet Class

The ADO.NET object model is rich, but at its heart, it is a fairly straightforward set of classes. The key class is the DataSet, which is located in the System.Data namespace (shown in the upper right-hand corner of Figure 10-1).

The dataset represents a rich subset of the entire database, cached in session state or in memory, without a continuous connection to the database. Periodically, you’ll reconnect the dataset to its parent database, which is how you update the database with changes to the dataset you’ve made, and update the dataset with changes in the database made by other processes.

The dataset doesn’t just capture a few rows from a single table but represents ...

Get Programming ASP.NET, 3rd Edition 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.