Wednesday, March 21, 2007

Typed Datasets

I've heard of typed datasets before but I just started using them on my current project. Wow, they're cool. Typed datasets are cool because you predefine the structure of the dataset (tables, columns, relationships, etc.) through Visual Studio 2005. Once defined, Visual Studio generates the code to create the class for the typed dataset. Now you get all the nice features of typical dataset but you can now also access the data in a type safe way. Instead of accessing the value of a column in row using:

currentColumn("ColumnA")

you can do this:

currentColumn.ColumnA

This is nice because a change of the data structure will cause compilation errors instead of runtime errors (runtime errors bad). Typed datasets are very cool. Microsoft has a very good tutorial on typed datasets: http://msdn2.microsoft.com/en-us/library/aa581778.aspx

4 comments:

Chris said...

If I recall correctly you used this same concept a few years back with the LLBLGEN application as well. It's a tremendous timesaver and forget about fat fingering all those columns into the code from now on.

Without a doubt typed data is the way to go.

Good Post
Chris

Cody Schouten said...

Typed DataSets have some similarities to LLBLGen. The nice thing is that it is built into the .NET framework and that it still has all the flexibility of datasets.

Travis said...

LLBLGEN is not similar to DataSets at all. Frans would scoff at your comparison.

DataSets (typed or not) are bad. Even Microsoft is starting to realize that. Look at the direction they are taking Orca. The Java guys have had it "right" for years now.

I was going to write a long drawn out post about the why they are so horrible, but I'm not in the mood to argue with Moss... :-)

Unknown said...

Sorry to rain on the parade, but DataSets are evil - the difference between typed and untyped DataSets are that they are just different shades of evil. You are rather late to the DataSet party and this has been argued millions of times in the past years, and is a dead topic for the most part. POCOs are the way to go and a DataSet is hardly that. It is a bloated container of junk. :P

I am using LLBLGen Pro right now on a project and it has nothing to do with DataSets.