Chapter 10: Data Access with ADO.NET 2.0


Overview

ADO.NET 1.x was the successor to ActiveX Data Objects 2.6 (ADO). The main goal of ADO.NET 1.x was to enable developers to easily create distributed, data-sharing applications in the .NET Framework. The main goals of ADO.NET 2.0 are to improve the performance of existing features in ADO.NET 1.x, to provide easier use, and to add new features without breaking backward compatibility.

Tip 

Throughout this chapter, when ADO.NET is mentioned without a version number after it (that is, 1.x or 2.0), this means that the statement applies to all versions of ADO.NET.

ADO.NET 1.x was built upon industry standards such as XML, and it provided a data access interface to communicate with data sources such as SQL Server and Oracle. ADO.NET 2.0 builds upon these concepts, while increasing performance. Applications can use ADO.NET to connect to these data sources and retrieve, manipulate, and update data. ADO.NET 2.0 does not break any compatibility with ADO.NET 1.x; it only adds to the stack of functionality.

In solutions that require disconnected or remote access to data, ADO.NET 2.0 uses XML to exchange data between programs or with Web pages. Any component that can read XML can make use of ADO.NET components. A receiving component does not even have to be an ADO.NET component if a transmitting ADO.NET component packages and delivers a data set in an XML format. Transmitting information in XML-formatted data sets enables programmers to easily separate the data-processing and user interface components of a data-sharing application onto separate servers. This can greatly improve both the performance and maintainability of systems that support many users.

For distributed applications, ADO.NET 1.x proved that the use of XML data sets provided performance advantages relative to the COM marshaling used to transmit disconnected data sets in ADO. Since transmission of data sets occurred through XML streams in a simple text-based standard accepted throughout the industry, receiving components did not require any of the architectural restrictions required by COM. XML data sets used in ADO.NET 1.x also avoided the processing cost of converting values in the Fields collection of a Recordset to datatypes recognized by COM. Virtually any two components from different systems can share XML data sets provided that they both use the same XML schema for formatting the data set. This continues to be true in ADO.NET 2.0, but the story gets better. The XML integration in ADO.NET 2.0 is even stronger now, and extensive work was done to improve the performance of the DataSet object, particularly in the areas of serialization and memory usage.

ADO.NET also supports the scalability required by Web-based data-sharing applications. Web applications must often serve hundreds, or even thousands, of users. By default, ADO.NET does not retain lengthy database locks or active connections that monopolize limited resources. This allows the number of users to grow with only a small increase in the demands made on the resources of a system.

In this chapter, you will see that ADO.NET 2.0 is a very extensive and flexible API for accessing many types of data, and because ADO.NET 2.0 is an incremental change to ADO.NET 1.x, all previous ADO.NET knowledge already learned can be leveraged. In fact, to get the most out of this chapter you should be fairly familiar with ADO.NET 1.x and the entire .NET Framework 1.x.

This chapter demonstrates how to use the ADO.NET 2.0 object model in order to build flexible, fast, scalable data access objects and applications. Specifically, it covers the following:

  • The ADO.NET 2.0 architecture

  • Some of the new features offered in ADO.NET 2.0, specifically batch updates, DataSet performance improvements, and asynchronous processing

  • Working with the Common Provider Model

  • Building a data access component




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