Implementing a .NET Framework Data Provider

A data provider in the .NET Framework enables you to connect to a data source in order to retrieve and modify data from the data source. A .NET Framework data provider also serves as a bridge between a data source and an ADO.NET DataSet.

The following table lists the .NET Framework data providers that are included in the .NET Framework.

.NET Framework data provider Description
.NET Framework Data Provider for SQL Server For Microsoft® SQL Server™ 7.0 or later.
.NET Framework Data Provider for OLE DB For data sources exposed using OLE DB.
ODBC .NET Framework Data Provider For data sources exposed using ODBC.

Note   The ODBC .NET Framework Data Provider is not included in the .NET Framework version 1.0. If you require the ODBC .NET Framework Data Provider and are using the .NET Framework version 1.0, you can download the ODBC .NET Framework Data Provider at https://msdn.microsoft.com/downloads. The namespace for the downloaded ODBC .NET Framework Data Provider is Microsoft.Data.Odbc.

Most database systems currently available are already accessible by ADO.NET through an existing OLE DB provider and the .NET Framework Data Provider for OLE DB or the .NET Framework Data Provider for ODBC. In addition, you can expose many data sources directly using XML.

ADO.NET also provides you with a minimal set of interfaces to enable you to implement your own .NET framework data provider. This section discusses the interfaces and classes you would use, and how to use them. There are a number of advantages to implementing a custom .NET framework data provider, including:

  • A simplified data access architecture, often with better maintainability and improved performance.
  • The ability to directly expose provider-specific behavior to consumers.
  • A specific interface for your consumers to access your data source within the .NET Framework.

There are, however, some situations where alternatives to implementing a custom .NET Framework data provider should be considered:

  • If pure data is all that is required to be exposed, and there is no need for associated concepts such as connections or transactions, consider exposing the data as XML data. The .NET Framework provides a comprehensive and integrated set of classes for working with XML documents and data. For more information, see Employing XML in the .NET Framework.
  • If a full suite of relational database features must be exposed in a standardized way, consider writing a full-featured OLE DB provider. Because OLE DB encompasses such a broad range of APIs, native OLE DB providers are best suited for interacting with generic tools.

The functionality provided by a .NET Framework data provider can be divided into the following categories:

  • The simple form of a .NET Framework data provider will only support the DataSet, through the IDataAdapter interface, and possibly will provide additional support for parameterized queries by implementing a version of the IDataParameter interface. Using this kind of .NET Framework data provider, you will be able to load a DataSet with data, modify the contents of the DataSet, and save the changes back to the original data source.
  • The complete form of a .NET Framework data provider supports both interaction with the DataSet and connected data access using connections, commands, transactions, and so on. Providers in this category implement the complete set of IData* and IDb* interfaces.

In This Section

  • Using .NET Framework Data Providers to Access Data
    Describes a .NET Framework data provider and how to use the .NET Framework data providers included with the .NET Framework to access Microsoft SQL Server and OLE DB data sources.
  • Accessing Data with ADO.NET
    Describes the ADO.NET architecture and components and how to use them to access existing data sources as well as to manage application data.