ADO.NET 2.0 Architecture Enhancements


The main design goals of ADO.NET 2.0 are as follows:

  • To add many new customer-driven features yet still remain backwardly compatible with ADO.NET 1.x

  • Improve upon performance of ADO.NET 1.x

  • Provide more power for power users

  • Take advantage of new SQL Server 2005 features

In distributed applications, the concept of working with disconnected data is very common. In a disconnected model, once you have retrieved the data you need, the connection to the data source is dropped - you work with the data locally. This model is very popular because it frees up precious database server resources, which leads to highly scalable applications. The ADO.NET solution for disconnected data is the DataSet object.

ADO.NET Components

To better support the disconnected model, the ADO.NET components separate data access from data manipulation. This is accomplished via two main components, the DataSet and the .NET Data Provider. Figure 10-1 illustrates the concept of separating data access from data manipulation.

image from book
Figure 10-1

The DataSetis the core component of the disconnected architecture of ADO.NET. It is explicitly designed for data access independent of any data source. As a result, it can be used with multiple and differing data sources, with XML data, or even to manage data local to an application such as an in-memory data cache. The DataSetcontains a collection of one or more DataTableobjects made up of rows and columns of data, as well as primary key, foreign key, constraint, and relation information about the data in the DataTable objects. It is basically an in-memory database, but what sets it apart is that it doesn’t care whether its data is obtained from a database, an XML file, a combination of the two, or somewhere else. You can apply inserts, updates, and deletes to the DataSetand then push the changes back to the data source, no matter where the data source lives! This chapter offers an in-depth look at the DataSetobject family and its ADO.NET 2.0 enhancements.

The other core element of the ADO.NET architecture is the .NET Data Provider, whose components are designed for data manipulation (as opposed to data access with the DataSet). These components are listed in the following table.

The DataAdapter uses Command objects to execute SQL commands at the data source to both load the DataSet with data and to reconcile changes made to the data in the DataSet with the data source. You will take a closer look at this later in the detailed discussion of the DataAdapter object.

Tip 

.NET Data Providers can be written for any data source, though this topic is beyond the scope of this chapter.

Open table as spreadsheet

Object

Activity

Connection

Provides connectivity to a data source

Command

Enables access to database commands to return and modify data, run stored procedures, and send or retrieve parameter information

DataReader

Provides a high-performance, read-only stream of data from the data source

DataAdapter

Provides the bridge between the DataSet object and the data source

The .NET Framework 2.0 ships with three .NET Data Providers: the SQL Server .NET Data Provider, the Oracle .NET Data Provider, and the OLE DB .NET Data Provider.

Important 

Do not confuse the OLE DB .NET Data Provider with generic OLE DB providers.

The rule of thumb when deciding which data provider to use is to first use a .NET Relational Database Management System (RDBMS)specific Data Provider if it is available, and to use the .NET OLE DB Provider when connecting to any other data source. For example, if you were writing an application that uses SQL Server, then you would want to use the SQL Server .NET Data Provider. The .NET OLE DB Provider is used to access any data source exposed through OLE DB, such as Microsoft Access, Open DataBase Connectivity (ODBC), and so on. You will be taking a closer look at these later.




Professional VB 2005 with. NET 3. 0
Professional VB 2005 with .NET 3.0 (Programmer to Programmer)
ISBN: 0470124709
EAN: 2147483647
Year: 2004
Pages: 267

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