Sunday, May 08, 2005

Scott Mitchell: Why I Don't Use DataSets in My ASP.NET Applications

...during my talk I mentioned how I, personally, rarely, if ever, use DataSets in my ASP.NET applications, sticking with the good ol' DataReader instead. Since then I have received a number of emails from attendees asking me why I don't use DataSets. Rather than responding to each questioner individually, I decided to write this article explaining my rationale.

A lenyeg:
Simply put, the DataSet's increased feature set makes it a less performant choice for reading data than the DataReader.

2 forrasra hivatkozik:
- According to A Speed Freak's Guide to Retrieving Data in ADO.NET, the DataReader is roughly thirty times more performant than the DataSet.
- Additional statistics can be found at Performance Comparison: Data Access Techniques, which compares the DataSet and DataReader against a number of common data access scenarios. The end result is that the DataReader is more performant than the DataSet, although this particular article's results do not show as large a performance difference between these two data objects as the Speed Freak article does.

Felteszi a kerdest: When is a DataSet Useful?
Es 2 ilyen lehetoseget hoz fel:
-In a desktop, WinForms application.
-For sending/receiving remote database information or for allowing communication between disparate platforms.
De hozzateszi:
Now, how often are you doing either of these things in your day-to-day ASP.NET development? Hardly ever, I'd wager, which is why you probably shouldn't be using DataSets! While the ASP.NET data Web controls are rather indifferent on what data object you use, you are suffering from a performance loss by choosing to use a DataSet.

A konkluzioja:
In this article we examined the fundamentals of the two data access objects provided by ADO.NET: the DataReader and the DataSet. Both objects have their time and place in .NET applications but, in my opinion, DataSets are rarely, if ever, useful in ASP.NET Web applications. There are exceptions, granted, but for the majority of Web applications, DataReaders should be used exclusively.