Chapter 34. The System.Data Namespace

The System.Data namespace represents the core of ADO.NET. It contains the fundamental data container classes such as DataSet. Every DataSet contains a collection of DataTable instances. Each DataTable holds a collection of DataRow objects, each of which contains the data for a single row. These data classes are independent of any ADO.NET provider. They simply store disconnected data. In addition, the DataSet also contains objects that describe structural information about your data. This structural information, which is also known as metadata, includes column-specific settings such as data type (found in DataColumn), foreign key and unique column constraints (represented by ForeignKeyConstraint and UniqueConstraint), and relations that link columns in different tables (represented by DataRelation).

Taken together, these objects act like an in-memory relational database, complete with versioning, column and table information, XML output, and automatic enforcement of identity and relational integrity rules. However, these classes are only part of the System.Data namespace. You’ll also find the interfaces that must be implemented by every ADO.NET provider. These interfaces define connections (IDbConnection), commands (IDbCommand), data readers (IDataReader), parameters (IDbDataParameter), transactions (IDbTransaction), and data adapters (IDbDataAdapter and IDataAdapter). These interfaces aren’t just a low-level part of ADO.NET. You’ll need to ...

Get ADO.NET in a Nutshell now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.