CHAPTER 22 ADO.NET PART II: THE DISCONNECTED LAYER
Understanding the Role of the DataSet
As noted previously, a DataSet is an in-memory representation of relational data. More specifically, a
DataSet is a class type that internally maintains three strongly typed collections (see Figure 22-2).
Figure 22-2. The anatomy of a DataSet
The Tables property of the DataSet allows you to access the DataTableCollection that contains the
individual DataTables. Another important collection used by the DataSet is DataRelationCollection.
Given that a DataSet is a disconnected version of a database schema, you can use it to represent the
parent/child relationships programmatically between its tables. For example, you can create a relation
between two tables to model a foreign key constraint using the DataRelation type. You can add this
object to the DataRelationCollection with the Relations property. At this point, you can navigate
between the related tables as you search for data. You will see how to do this later in the chapter.
The ExtendedProperties property provides access to the PropertyCollection object, which allows
you to associate any extra information to the DataSet as name/value pairs. This i