Summary of New Features in Version 2.0



Summary of New Features in Version 2.0

The remainder of this book looks in detail at what's new and the fundamental changes to existing techniques for working with relational and XML data in version 2.0 of the .NET Framework. We've divided the content into the two obvious sections:

  1. The relational data management features in ADO.NET, covering the namespace System.Data and its subsidiary namespaces

  2. The XML data management features in the .NET Framework, covering the namespace System.Xml and its subsidiary namespaces

These two sections provide a summary of what is new in both ADO.NET and System.Xml. However, bear in mind that one of the aims in the .NET Framework is to integrate data from independent data sources and data in different formats, so the distinction between the two approaches listed above is not absolute. Often you will work with XML data through the various ADO.NET objects or manipulate a relational data store using objects from the System.Xml namespaces.

Summary of New Features in ADO.NET

The new features of ADO.NET that are covered in this book are listed below.

  • Multiple Active Results Sets (MARS) allows a connection to support multiple concurrent commands and multiple open sets of results (for example, multiple open DataReader instances). You can open a results set from a query, and then execute subsequent commands over the same connection while the previous one is still open and being accessed.

  • The addition of truly asynchronous operations for connections and commands, allowing code to concurrently fetch and process data from multiple sources. This can provide a considerable performance boost in many situations—particularly when combined with the MARS feature.

  • Support for paging data rows is now built in. The new ExecutePage Reader method of the Command class provides more efficient access to data that is displayed in separate pages, rather than as a single list.

  • New features for executing SQL batched commands. Commands that contain more than one SQL statement can now be executed in a more efficient manner with no extra work required from the developer.

  • The provision of in-process server-side cursors for programmatic processing of data within a stored procedure. Because SQL Server "Yukon" can host the Common Language Runtime (CLR), you can write code that uses server-side cursors without losing out on performance to the same extent as traditional ADO methods.

  • The addition of change notifications for SQL Server, allowing code to cache data and results sets, but automatically react to any changes that invalidate the original data within the database.

  • SQL Server "Yukon" now supports User-Defined Types (UDTs), allowing you to build your own data types as .NET assemblies and install them into the database server and client so that information can be accessed in a more natural and efficient manner.

  • A set of new classes, called ObjectSpaces, that allow data to be handled directly as objects, rather than as individual values.

  • New classes in ADO.NET support programmatic batch updates and bulk data loading from various data sources into SQL Server.

Summary of New Features in System.Xml

The System.Xml namespaces have been extended considerably in version 2.0, in order to implement the main aims listed below.

  • Integrating XML data with a range of data sources, and exposing a programming model that follows the same paradigm as that used in ADO.NET for reading and updating data. This is, in many ways, a parallel with the DataAdapter techniques used with the ADO.NET DataSet class but based on the XML data model rather than the relational data model.

  • Adding built-in support for XQuery and XML Views. This provides a technique for distributed query processing over multiple different data sources, though for the current release this is targeted at SQL Server and XML documents. This is in effect the migration to .NET of the SQLXML 3.0 technology available in SQL Server 2000 today, but with several enhancements in the mapping technology and the query capabilities. Updates via XML Views are supported through the use of declarative "updategrams" that detail the changes that have occurred to the data.

  • Providing better support for the storage of XML data and the integration of relational and XML data management techniques for the new version of SQL Server ("Yukon").

  • Enhancing existing version 1.0 XML classes to support recent W3C standards to provide closer integration between the components in System.Xml; significantly improve the performance of XML parsing, XML schema validation, and XSLT transformations; and enable XML schema types for the classes.

To meet these aims, the System.Xml and subsidiary namespaces in version 2.0 of .NET contain several new classes and improvements to existing ones.

  • There are major changes to the XPathDocument class. The content can now be edited, and change control is built in so that updates, inserts, and deletes are automatically tracked. It can also be remoted while preserving the XML data model and XML schema types.

  • A new XPathChangeNavigator class is introduced to allow code to access the changes in an XPathDocument, and a new class named XPathEditor can be used to perform changes.

  • The introduction of XML Views, a mapping between relational data types and XML data type definitions, allows relational data stored in SQL Server to be viewed and handled as XML.

  • A new XmlAdapter class mirrors the concepts of the ADO.NET DataAdapter class. It connects an XML document to a database via an XML View, allowing data to be read and changes to be persisted to the database through auto-generation of SQL statements.

  • Updates to the XmlReader and XmlWriter classes support the XML schema types, and a new XmlFactory class provides a mechanism for generating XmlReader, XmlWriter, and XPathNavigator instances based on user-defined settings.

  • XQuery is supported through the new XQueryProcessor class, used in conjunction with an XPathNavigator class to query and return information from XML documents using the W3C XQuery language. This language has a more readable (non-XML) syntax for ease of authoring. XQuery is to XML what SQL is to relational databases. XQuery is set to become the preferred query language when querying over XML documents, XML Views, or any data source exposed as XML.

  • The latest version of SQL Server ("Yukon") adds features that integrate with version 2.0 of System.Xml. This includes the provision of a new first-class data type for XML, the xml data type, allowing SQL Server to be used as a store for XML documents. This allows columns in a table to be marked as an xml data type, and XQuery queries can be performed over the XML and associated schema to provide type information.

These brief listings of the new features should whet your appetite to learn more, and that's what we'll be doing in the remainder of this book. To help you find what you need, a later section of this chapter presents a roadmap of the contents of the remaining chapters.