ADO .NET Disconnected Classes

ADO.NET disconnected classes are the basic building blocks of the ADO .NET architecture. These classes are loosely coupled with data providers. The System.Data namespace defines these classes.
 

The System.Data Namespace

 
The System.Data namespace consists of classes that are the basic building block of the ADO.NET architecture. These classes are also known as disconnected classes because they store disconnected data and can work without data providers.
 
Table 1 describes some of the common classes of the System.Data namespaces. 
 
CLASS
DESCRIPITION
Constraint, ConstraintCollection, UniqueConstraint, ForeigenKeyConstraint
Constraints are rules set on a database table and its columns to maintain the integrity of the data. The Constraint class objects represent a constraint that you can apply on a DataColumn object. Some of these constraints are the primary key, uniqueness, and foreign key. The ConstraintCollection class represents a collection of constraints for a DataTable. The UniqueConstraint and ForeignKeyConstraint represent unique and foreign key constraints.
DataColumn, DataColumnCollection
The DataColumn object represents a column of a table. The DataColumnCollection represents a collection of columns of a table.
DataRelation, DataRelationCollection
The DataRelation object represents a parent/child relationship between two DataTable objects. The DataRelationCollection represents a collection of DataRelation.
DataRow, DataRowCollection
A DataRow object represents a row of a table, and the DataRowCollection represents a collection of rows.
DataRowView
The DataRowView represents a view of DataRow. It's useful when you want to attach a DataRow with databound controls such as a DataGrid.
DataSet
In ADO.NET a DataSet object is a replacement of the ADO recordset and represents an in-memory cache of data. A DataSet is a collection of DataTable objects.
DataTable, DataTableCollection
A DataTable object represents an in-memory cache of a table, and the DataTableCollection is a collection of DataTable objects.
DataView
A DataView object represents a data bindable, for sorting, filtering, searching, editing, and navigation.
DataViewManager
The DefaultViewManager represents the default view of a DataSet or DataTableCollection.
 
Table 1: The System.Data Namespace classes
 
The System.Data namespace also defines many interfaces that are base classes for the ADO.NET data provider classes. Table 2 describes these namespaces.
 
Table 2: The System.Data Namespace Interfaces
 
INTERFACE
DESCRIPTION
IDataParameter
This interface represents a parameter to a Command object and is the base class of provider-specific DataParameter.
IDataParameterCollection
This interface represents a collection of DataParamater objects and is the base class of provider-specific DataParameterCollection classes.
IDataReader
This interface defines methods and properties to read forward-only streams and is implemented by provider-specific DataReader classes.
IDataRecord
This interface defines methods and properties that provide access to the column values within each row for a DataReader and is implemented by data providers that access relational databases.
IDbCommand
This interface defines methods and properties to represent a SQL statement that is executed while connected to a data source and is implemented by data providers that access relational databases.
IDbConnection
This interface is the base class for data provider Connection classes and represents an open connection to a data source.
IDbDataAdapter
This interface is a base class for provider-specific DataAdapter classes and represents a set of command-related properties used to fill a DataSet and update a data source.
IDbDataParameter
This interface defines classes and methods that represent a parameter to a Command object and used by the Visual Basic.NET data designers.
IDbTransaction
This interface is the base class for provider-specific Transaction classes that represents a transaction.
ITableMapping
This namespace is the base class of TableMapping classes and defines methods and properties that map a data source table with a DataTable.
ITableMappingCollection
This namespace is the base class of TableMappingCollection class and defines members and properties that represent a collection of TableMapping objects.
 
The System.Data namespace also defines many enumerations and delegates.
 
Once you have an idea of what classes the System.Data.Common namespace contains, you'll have no problem understanding how these classes in a sample application.
 

The System.Data.Common Namespace

 
As its name says the System.Data.Common namespace contains classes shared by the .NET data providers. Some of these classes are the base classes for the .NET data provider classes. Table 3 defines some of these classes.
 
CLASS
DESCRIPTION
DataAdapter
The DataAdapter class represents a data adapter that works as a bridge between a data source and dataset. It implements the Fill and Update methods. The Fill method fills data from a data source to a DataSet using Command objects. This class is a base class for the OleDbDataAdapter, SqlDataAdapter classes.
DataColumnMapping
If you don't want to use default column names of table columns to access these columns. You can define your own names. You map your custom names with the original column names through data adapters and use these names in your application. The SourceColumn and DataSetColumn properties of this class represent the source column name and DataSet column name.
DataColumnMappingCollection
Collection of DataColumnMapping object
 
DataTableMapping
You can even map a database table to a DataTable and use this DataTable as the source in your applications. The ColumnMappings property returns DataColumnMappingCollection for the DataTable. The DataSetTable and SourceTable properties represent the DateTable and source tables.
DataTableMappingCollection
Collection of DataTableMapping objects.
 
DbDataAdapter
Inherited from DataAdapter, this class implements the IdbDataAdapter interface. This class is used as the base class of a data provider's DataAdapter classes.
DbDataPermission
Ensures that data providers have security to access data. This class is a base class from the OleDbDataPermission, ODBC DataPermission, and SqlDataPermission classes.
 
Table 3: The System.Data.Common Namespace
 

Conclusion

 
Hope this article would have helped you in understanding ADO.NET Disconnected Classes. See my other articles on the website on ADO.NET.