Understanding the Generic Data Provider Model

Let's examine a generic data provider model before looking at specific data providers. Figure 4-1 shows a generic class model of a data provider. The same component model applies to all of the data providers, with minor changes. All data providers implement a similar class hierarchy model, so once you're comfortable with one data provider, you can easily manipulate the other data providers in no time. It's usually just a matter of changing the class names and the connection string.

click to expand
Figure 4-1: A generic data provider model

The Connection component of a data provider is the first component, and it communicates with a data source. A DataAdapter sits between a DataSet and the data source and passes data back and forth. The DataAdapter's Fill method fills data from a data source to a DataSet, and the Update method of the DataAdapter saves changes from a DataSet to a data source. In Chapter 3, you saw how to use the data once you have it in a DataSet through the DataTable, DataRow, and DataColumn objects.

The Command and CommandBuilder objects are two more important components of a data provider. A Command component uses SQL queries to transfer data back and forth from a data source to an application and vice versa. A Command or CommandBuilder object can use a DataAdapter or a DataReader. The DataReader is a fast, read-only gateway of data.

You'll begin your understanding of the ADO.NET data providers by examining the Sql data provider defined in the System.Data.SqlClient namespace. This name-space contains the classes necessary to manipulate the data providers.

Applied ADO. NET(c) Building Data-Driven Solutions
Applied ADO.NET: Building Data-Driven Solutions
ISBN: 1590590732
EAN: 2147483647
Year: 2006
Pages: 214

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net