The Version 2.0 Technology Preview Release



The Version 2.0 Technology Preview Release

The Technology Preview version contains the core changes planned for version 2.0 of the .NET Framework, including the provision of new features prompted both by Microsoft's own development team's inspirations and by feedback from the version 1.0 customer base. It also, of course, includes fixes to known issues with the version 1.0 classes and in some places a tidying up of the class interfaces.

But this is by no means a definitive view of what the final product will contain. It is a good general guide to the way the product is changing and to the kinds of features that will be encompassed in the release version (due toward the end of 2004).

So, the Technology Preview release—and this book—will help you as a developer to understand how data access in .NET is moving and to be more prepared for the changes when they arrive. It means that you can see how the Microsoft team is thinking about the future of the product and will also allow you to design your applications to suit this evolution. Just bear in mind the proviso that the final release version will no doubt be subtly different from what you see here.

Enhancements in Relational Data Management

Although some developers initially struggled with the move away from the simplicity of the single ADO Recordset object in version 1.0 of the Framework, the .NET relational data access model offers proven advantages in several key areas.

  • As application development has moved from the connected client/server model toward Web-based applications, the focus has increasingly been on a disconnected data access approach. The .NET relational data access techniques provide a rich disconnected environment that makes it easy to remote data to clients, access data server-side, and perform staged or bulk data updates.

  • The explicit factoring between objects that connect to and use database resources and objects that contain pure state provides the developer with more control over database interactions, performance characteristics, and application behavior.

  • Programming in the .NET environment predominantly involves managed code, which runs under the control of the Framework runtime. The ADO.NET classes within the .NET Framework are exposed as fully managed code, providing a safe, consistent development platform with excellent error handling and debugging capabilities.

  • The DataSet object introduced in version 1.0 provides a "container" for storing data from multiple tables, and optionally the relationships between these tables, together with associated classes and methods that provide easy updating of the source data and serialization to XML for transmission across networks. In version 2.0, new classes are added to the Framework to make this approach even more flexible.

  • The use of data binding to display data from a variety of sources has grown in importance, especially when building Web applications. ASP.NET provides a range of controls that can perform data binding in different ways, and the DataReader object introduced in ADO.NET makes this a highly efficient approach for displaying relational data in grid or free-form formats.

  • New classes provide a tighter integration with XML data and components.

These are only a few of the reasons that the .NET data access model is proving successful. There are plenty more new features in version 2.0 of the Framework. We'll be summarizing them later in this chapter, and then we'll go on to examine them in more depth in later chapters.

Enhancements in XML Data and Document Management

While the move toward Web-based application development has changed the requirements we have for relational data access, there have been more fundamental changes in the area of document and unstructured data management. Over the last few years, XML has become the de facto way to persist this kind of data in a way that is human-readable, can be machine-processed, and avoids custom binary representations.

Since its introduction, XML has evolved in several different directions. While the unstructured information storage paradigm is still extremely important, we've also come to see XML as a way to serialize and persist structured and hierarchical data (for example, rows and columns from a data table, or more than one related data table).

Prior to .NET, the usual way to manage XML was through the MSXML component, either via the XML Document Object Model (DOM) class, used to build an in-memory tree representation, or through the Simple API for XML (SAX) model, which "pushes" events to the application. Although this works well enough, .NET version 1.0 introduced several exciting new alternatives for manipulating XML data.

  • A fast, forward-only, "pull" model XML parser named XmlReader that is able to read streams of XML in a highly efficient manner. This innovative API provides a simpler and more intuitive approach to reading XML documents. The complementary class XmlWriter is used to generate XML to a stream, including automatic indentation of the output and white-space control.

  • An XML data store that is used to load XML documents into memory for editing and updating. This is the XmlDocument class, and it provides full standardization with the World Wide Web Consortium (W3C) recommendations for the XML DOM level 2.

  • A cursor-style API for navigating through XML documents. The XPathNavigator class implements the XPath 1.0 specification for querying XML documents. This is combined with a read-only store optimized for XPath queries, called the XPathDocument. In version 2.0 of the Framework, the XPathDocument is extended to provide more features, including change tracking and the ability to update data stores in a manner similar to the ADO.NET DataSet. The XPathNavigator is also extended to support the more powerful XML query languages for XPath 2.0 and XML Query Language (XQuery).

  • The XmlDataDocument object, which acts as a bridge between XML and relational data by allowing data to be viewed and manipulated as XML or as a DataSet. While this class is useful, the new features of the XPathDocument will probably prove to be more flexible in this area, as well as allowing the data to be remoted across a network.

  • A series of objects that allow developers to create XML schemas and validate XML documents against supplied XML schemas, along with objects such as the XslTransform class to perform transformations using XML Stylesheet Language Transformations (XSLT) stylesheets.

In version 2.0 of the Framework, there are many enhancements in the XML data management arena. In addition to improvements to the XPath Document class, there are new features for working with XQuery and better integration with the new version of SQL Server ("Yukon") to be released around the same time as version 2.0 of the Framework.