What's New in ADO.NET 2.0?
Amidst all the hype around Whidbey and Yukon, one area that's been perhaps neglected is the fairly significant changes that have been made to ADO.NET. Having spent a fair amount of time working with customers on data-driven applications, there are a number of questions that I get asked almost every time, including:
- How do I get ADO.NET to make multiple updates in a single batched operation?
- How do I implement a data tier which is provider agnostic without resorting to OLE DB?
- How do I convert a DataReader into a DataSet?
- How can I optimise DataSet serialisation?
- How can I use two DataReader objects simultaneously?
None of these are impossible to achieve today, but all of them require a fair amount of work. The good news is that ADO.NET 2.0 provides simple solutions to each of these problems out of the box. There's a new UpdateBatchSize property on DataAdapters, that supports batched updates; there's a provider-agnostic class factory; a Load method on DataTable objects that takes a DataReader as a parameter; there's a new binary serialisation option for DataSets, and finally there's support for Multiple Active Result Sets (MARS) in MDAC 9.0.
Where can you go for more information on these? There's a little bit of information on the ADO.NET website, but today at least that consists primarily of slideware from the PDC. But I was blown away by a great demo from Pablo Castro (one of the ADO.NET PMs) that's just gone live on MSDN TV. Now I have a confession to make - I generally hate webcasts. For some reason, when I'm watching something online my attention span drops off and I start being distracted by email. But Pablo's session was pure demo - no marketing fluff - no explanation of the architecture - just straight into coding C# in Visual Studio 2005. The demo segment is about 20 minutes, and he demonstrates how ADO.NET 2.0 solves at least four of the problems highlighted above. A tip - download the demo file only rather than the full presentation - you can reduce the download from 58MB to 14MB and just miss the 2 minute intro.
Go on - skip browsing aimlessly around the web and take twenty minutes out to learn some really cool stuff - you won't regret it!
Comments
- Anonymous
July 14, 2004
Pablo is definitely the man. Any idea when the next round of stuff - either articles or web casts might be forthcoming? - Anonymous
July 14, 2004
Question: "How do I implement a data tier which is provider agnostic without resorting to OLE DB?"
Answer: You STILL cannot! Why? Because there is no common base class/interface for database exceptions. I cannot believe this has been overlooked for so long... it's been central to JDBC's ability to do this, and I figured given the knownedge of JDBC you guys could do a better job still...
sigh - Anonymous
October 08, 2006
Virual Labs from Microsoft http://msdn.microsoft.com/virtuallabs/sql/ • Improving .NET Application