ADO.NET (or the new ActiveX Data Objects technology) is the primary relational data access model for Microsoft .NET-based applications. It may be used to access data sources for which there is a specific .NET Provider, or, via a .NET Bridge Provider, for which there is a specific OLE DB Provider, ODBC Driver, or JDBC Driver. ADO.NET is sometimes considered an evolution of ADO technology, but it is important to note that some major changes were made between the two.
ADO.NET consists of two primary parts:
Data provider
- The provider objects. These classes provide access to and communicate with a data source, such as a SQL Server database. Each data source has its own set of provider objects, but they each have a common set of suffixes:
- -Connection: Provides a connection to the data source, needed to access it. Also acts as an abstract factory for command objects.
- -Command: Used to perform some action on the data source, such as reading, updating, or deleting relational data.
- -Parameter: Describes a single parameter to a command. A common example is a parameter to a stored procedure.
- -DataAdapter: A bridge used to transfer data between a data source and a DataSet object (see below).
- -DataReader: An object used to efficiently process a large list of results one record at a time without storing them.
DataSet
- The DataSet objects, a group of classes describing a simple in-memory relational database. There is only one, data-source-neutral, set of DataSet objects, but both data and database schema structure can be imported from other data sources with -DataAdapter objects. The classes form a containment hierarchy:
- A DataSet object represents an entire database. It can contain tables and relationships between those tables.
- A DataTable object represents a single table in the database. It has a name, rows, and columns.
- A DataColumn represents a column of the table, including its name and type.
- A DataRow object represents a single row in the table, and allows reading and updating of the values in that row, as well as retrieving any rows that are related to it through a primary-key foreign-key relationship.
- A DataRelation is a relationship between tables, such as a primary-key foreign-key relationship. This is useful for enabling DataRow's functionality of retrieving related rows.
- A Constraint describes an enforced property of the database, such as the uniqueness of the values in a primary key column. As data is modified any violations that arise will cause exceptions.
Sources of ADO.NET Providers
- Microsoft ships providers for a few databases and a Bridge to ODBC drivers for use with the Microsoft CLR, on Windows
- DataDirect Technologies ships 100% managed providers that are for the primary corporate databases (Oracle, Sybase, DB2, SQL Server, Progress RDBMS)
- OpenLink Software ships providers for a number of target databases, including Bridges to other data access mechanisms, for use with either the Microsoft or Mono CLR implementations, on Windows,
ADO.NET and Visual Studio.NET
Functionality exists in the Visual Studio .NET IDE to create specialized subclasses of the DataSet classes for a particular database schema, allowing convenient access to each field through strongly-typed properties. This helps catch more programming errors at compile-time and makes the IDE's Intellisense feature more useful.
ADO Vs. ADO.NET
A useful discussion of the shift from ADO to ADO.NET may be found in the MSDN article ADO.NET for the ADO Programmer.
See also