Compartilhar via


What's New in ADO.NET 

The following features are new in ADO.NET version 2.0.

Managed Providers

Server Enumeration

Asynchronous Processing

  • Allows you to perform asynchronous database operations using an API that is modeled after the asynchronous model used by the .NET Framework. For more information, see Performing Asynchronous Operations.

Multiple Active Result Sets (MARS)

Bulk Copy Operations

New SQL Server Max Data Types

  • Provides support for varchar(max), nvarchar(max), varbinary(max) data types in SQL Server 2005. For more information, see Working with Large Value Types

SQL Server User-Defined Types

SQL Server Notifications

  • Allows .NET Framework applications to send a command to SQL Server and request that a notification be generated if executing the same command would produce result sets different from those initially retrieved. For more information, see Using Query Notifications.

Transactions with SQL Server Snapshot Isolation

  • Provides support for snapshot isolation, a SQL Server 2005 mechanism designed to reduce blocking in OLTP applications. For more information, see Using Snapshot Isolation.

Database Mirroring in SQL Server 2005

  • Provides support for database mirroring in SQL Server 2005 with new connection string syntax for specifying a failover partner server. For more information, see Using Database Mirroring.

Provider Statistics

  • Provides support for retrieving runtime statistics in SQL Server 2005. Currently 21 different counters are available from the .NET Provider for SQL Server. For more information, see Using Provider Statistics.

Change Password in SQL Server 2005

  • Allows .NET Framework applications to change password of a user account without requiring administrator intervention. For more information, see ChangePassword.

Batch Processing

Tracing

Partial Trust

Connection Pooling Control

SQL Server XML Data Type Support

  • SQL Server 2005 has a new XML data type, and System.Data.SqlClient provides robust support for it on the client. The XML values are exposed using the System.Xml framework for seamless integration with the .NET programming model.

Integration with System.Transactions and Promotable Transactions Optimization for SQL Server 2005

  • .NET 2.0 includes a new transactions framework, accessible through the System.Transactions namespace. When combining System.Transactions for distributed transaction management, System.Data.SqlClient for database access, and SQL Server 2005 as the back end, it is possible to optimize distributed transactions so that the extra cost of making them "distributed" is only incurred when the transactions are actually needed.

Disconnected Classes

DataSet Enhancements

DataSet Enhancements

  • A new index engine improves the performance of insert, delete, and modify operations to DataTable and DataRow objects. An index or primary key must be defined in the base table.

Binary Serialization for the DataSet

  • This new option enables a DataSet and a DataTable to be serialized in binary format when using binary transports over remoting. In most cases this will result great performance improvements and a noticeable reduction in both memory and CPU usage when using DataSet/DataTable objects in applications that use remoting to connect to different tiers.

DataTable as a Stand-Alone Object

  • Many methods that were only available in the DataSet in previous versions are now available in the DataTable as well (such as ReadXml and WriteXml). Also, a DataTable can be serialized by itself, so it’s no longer necessary to have a DataSet with a single table just to expose the table through Web services or any other mechanism that requires serialization.

Create a DataTable from a DataView

  • You can now create a DataTable from a DataView. The new DataTable will have the same set of rows as the current DataView. Optionally the columns of the new DataTable can be a subset of the DataView columns. The rows can be either all rows or only distinct rows. For more information, see ToTable.

Schema Inference Engine Enhancements

  • The schema inference engine has been enhanced to infer types when enough information is available; it is also significantly faster.

Namespace-Qualified Tables

  • A DataSet can now support tables that have the same TableName but with a different Namespace, providing a mechanism to avoid naming conflicts.

New DataTable Loading Capabilities

  • The new Load method for DataTables and DataSets can stream a DataReader into a DataTable directly. The Load method also has new options for load behavior that extend the functionality available through the DataAdapter.

Row State Control

  • The new SetAdded and SetModified methods allow applications to explicitly manipulate the row state for DataSet and DataTable rows.

Enhanced Support for Custom Defined Types

  • The DataTable provides more support for custom, user-defined types. XML serialization has been extended to support polymorphism. For example, a Person Column can store an Employee instance that gets serialized and de-serialized to and from XML without loss of any type fidelity. Additionally users can now implement the new change tracking interfaces that enable the DataTable to track changes for such objects.

XML/XSD Enhancements

  • Added support for reading and writing simple types in XSD. Added support for reading and writing of multiple schemas to a stream. Added support for reading and writing of XSD/XML where a single table or XML Element is nested inside two or more parent tables.

DataRow Enhancements

  • The new IndexOf can be used to find position of row in DataTable.Rows collection.

Change Position of Column in DataTable

  • The new SetOrdinal method allows users to change the position of the column in a DataTable.

DataView Performance Improvements

  • The DataView in ADO.NET 2.0 uses a new update algorithm resulting in significant improvement in DataView maintenance.

DataColumn Expressions

  • An expression in a DataColumn can include columns from the same DataTable. The expression can be updated, and the column value is maintained.

Schema Serialization for Typed DataSet

  • Typed DataSets can skip the schema component from being serialized by setting the SchemaSerializationMode enumeration to ExcludeSchema.

Provider-Independent APIs

.NET Data Provider Enumeration

Provider Independent API

Schema Discovery

  • Schema discovery allows applications to request managed providers to find and return information about the database schema of the database a given connection is connected to. Different database schema elements such as tables, columns and stored-procedures are exposed through the GetSchema methods of each provider's Connection class. For more information, see Obtaining Schema Information from a Database.

See Also

Other Resources

ADO.NET