ADO.NET changes in Whidbey (May 2004 CTP)

Dan Fox of Quilogy presented this topic

First, What’s not going to be in ADO.NET 2.0 ๐Ÿ™

  • ObjectSpaces moved to the Longhorn wave
  • Data Paging – (DbCommand.ExecutePageReader method)
  • Stand-alone table objects (DbTable and its descendants)
  • Server cursors – SqlResultSet
  • Asynchronous connection objects

ObjectSpaces are out (too bad)

  • Microsoft is building the Microsoft Business Framework (MBF) for Longhorn, using WinFS so it’s off until then
  • Dan is going to demo the ObjectSpaces and the Entitity-to-Database Mapper
  • OPath is similar to XPath, but is an object way of retrieving subsets of objects
  • Demo ObjectSpaces and mapper – too bad it’s out! ๐Ÿ™

New: XmlAdapter

  • XQueryCommand – a command that you can populate from a file or text
  • XmlDataSourceResolver(“friendlyname“, conn) – is this SqlClient only?
  • XmlAdapter – has a fill method which runs the XQuery from the .xml file against the resolved name above

Improved: Enhancing ADO.NET

  • Provider Factories – abstract classes, implementing the class factory pattern
  • DbConnection – each of the various connected layer classes now have abstract base classes
  • SqlClientFactory (inherits from DbProviderFactory) instantiates and returns a SqlConnection
  • My code will call DbProviderFactories – configurable in machine.config (in System.Data) section
  • Demo – very cool

New: Bulk Copy from the client

  • Programmatically invoke BCP – very simple interface
  • System.Data.SqlClient.SqlBulkCopy – SqlBulkCopyColumnMapping objects need to be defined
  • Method is WritetoServer()
  • Demo – works great

New: Asynchronous Data Access

  • BeginExecuteNonQuery, BeginExecuteReader, BeginExecuteXmlReader – the same pattern .NET has had
  • AsyncCallback object is passed to the callback method
  • Background threads are being used and Windows Forms controls are only updated on the thread they were created – this was the problem I had in my MSDN article; this is done through a delegate; Me.Invoke(ui)
  • Demo – similar to what I’ll be showing tomorrow ๐Ÿ˜

New: DataSet Changes

  • Loading DataSet from a DataReader
  • Reading the contents of a DataTable as a DataReader – Dim DRT as DataTableReader = DS.GetDataReader()
  • DataTable – can be serialized (WriteXml, WriteXmlSchema, ReadXml, ReadXmlSchema)
  • DataSets can be serialized in a Binary fashion, to boost .NET Remoting performance

Performance Improvements

  • Index engine enhancements
  • DataAdapter Batch Updates
  • Single row return – Dim R as SqlRecord = myCmd.ExecuteRow()

Features of Yukon (SQL Server 2005)

  • MARS
  • SqlDependency
  • SqlNotificationRequest – more detailed than SqlDependency, queues, etc.
  • OutputCache in ASP.NET – @Page parameter SqlDependency=“CommandNotification“
  • Yukon Types UDTs – classes in .NET, instantiate them and store them directly in Yukon, and then read them out as well
  • Snapshot Isolation – essentially readers don’t block writers; this is supported via MDAC, but will also be visible in SqlClient as another IsolationLevel setting (IsolationLevel.Snapshot) on the SqlTransaction class