Selecting Interfaces and Classes for Implementation

Before implementing your .NET Framework data provider, you should define which of the ADO.NET interfaces and classes you will implement. You may want to implement the entire set of interfaces, though this is not a requirement. Or you may simply want to implement a subset of the interfaces and classes, such as a DataAdapter-only implementation where clients would deal primarily with a DataSet and would use your .NET Framework data provider only as a bridge between the DataSet and your data source.

If your .NET Framework data provider will not support a particular ADO.NET class or method, implement the class or method as no-operation. If a client will expect a particular behavior, throw a NotSupportedException.

The following table describes the interfaces available for implementation and when a particular interface would be required.

Interface Description Implementation notes
IDbConnection Represents a unique session with a data source. In the case of a client/server database system, the session may be equivalent to a network connection to the server. Required for a complete .NET Framework data provider implementation.
IDbTransaction Represents a local transaction. Required for a complete .NET Framework data provider implementation. Providers are not required to support nested transactions, though the IDbTransaction API is designed to allow this.
IDbCommand Represents a query or command that is used when connected to a data source. Required for a complete .NET Framework data provider implementation.
IDataParameter Allows a user to implement a parameter to a command and its mapping to DataSet columns. Required for a complete .NET Framework data provider implementation.

Optional for an IDataAdapter-only implementation.

IDataParameterCollection Allows a user to implement a parameter to a command and its mapping to DataSet columns. Required for a complete .NET Framework data provider implementation.
IDataReader Provides a method of reading a forward-only read-only stream of data from your data source. Required for a complete .NET Framework data provider implementation.
IDataAdapter Allows a user to implement a DataAdapter for populating a DataSet and resolving changes in the DataSet back to the data source. Required for any .NET Framework data provider implementation.
IDbDataAdapter Allows a user to implement a DataAdapter geared towards relational databases. Represents a set of commands and a database connection that are used to fill the DataSet and reconcile changes made to the DataSet with the source database. Required for a complete .NET Framework data provider implementation.

The .NET Framework also includes the DbDataAdapter Class, which provides a nearly complete implementation of the IDataAdapter and IDbDataAdapter classes. The DbDataAdapter class can be used by any provider that implements the complete set of .NET Framework data provider interfaces.

See Also

Implementing a .NET Framework Data Provider | Getting Started with a .NET Framework Data Provider Implementation | Sample .NET Framework Data Provider