Managed Providers

Managed provider is a term used for a group of .NET components that implement a fixed set of functionality set forth by the ADO.NET architecture. This enforces a common interface for accessing data. In order to build our own managed provider, we must provide our own implementation of System.Data.Common.DbDataAdapter objects and implement interfaces such as IDbCommand, IDbConnection, and IDataReader. We are not building our own managed provider here; however, we do dive into each of these classes and interfaces in this section.

Most of the time, developers don’t have to know how to implement managed providers, even though this might increase their productivity with regard to ADO.NET. Understanding how to use the stock managed providers alone is sufficient to develop your enterprise application. Microsoft provides two managed providers in its current release of ADO.NET: OLE DB and SQL. The OLE DB managed provider comes with OleDbConnection, OleDbCommand, OleDbParameter, and OleDbDataReader. The SQL Server managed provider comes with a similar set of objects, whose names start with SqlClient instead of OleDb, as illustrated in Figure 5-3. The implementation of this core function set for managed providers is packaged in the System.Data.Common namespace, while the interfaces for the data adapter classes are in System.Data. The implementation for the ADO managed provider is in System.Data.OleDb, and the SQL managed provider is in System.Data.SqlClient.

Figure 5-3. Managed ...

Get .Net Framework Essentials now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.