Brian Noyes has a
really great article on TheServerSide.NET. I don't want to
steal his thunder, but this is a topic and
delima that I've had for years. When
.NET 1.0 first went RTM, I thought typed-DataSet was the
coolest thing since
sliced bread. Maybe even after that for a while too, haha. With the typed-DataSet, you had all of the promises of DataSet with strong typing.
The problem with the DataSet was its overhead and lack of extensibility.
Although, hate it after a while, maybe
it was the desire to (hopelessly?) pursue the purist OO Holy Grail; that is
certainly part of it. My
LLBLGen Pro
entities can do everything a typed-DataSet can do, and more. I mean, you can't
(couldn't) do cool OO stuff like this with your DataSet, but you can with a custom object model...
public abstract class FamilyCook {
public FamilyCook() { }
public void MakeDinner() {
string foodName = this.TakeOrder();
this.PrepareFood(foodName);
this.SetTable();
this.AnnounceFoodIsReady(foodName);
}
public string TakeOrder() {
Console.WriteLine("What do you guys want to eat?");
return Console.ReadLine();
}
public abstract void PrepareFood(string foodName);
public abstract void SetTable();
public void AnnounceFoodIsReady(string foodName) {
Console.WriteLine(foodName + " is ready!");
}
}
public class Mom : FamilyCook {
public override void PrepareFood(string foodName) {
Console.WriteLine("Break out the pots and pans and slave over a hot stove all day to make " + foodName);
}
public override void SetTable() {
Console.WriteLine("Put plates on the table");
Console.WriteLine("Put silverware on the table");
Console.WriteLine("Light a candle");
Console.WriteLine("Make things look nice, n'stuff...");
}
}
public class Dad : FamilyCook {
public override void PrepareFood(string foodName) {
Console.WriteLine(String.Format("Drive to the {0} store and buy {0}.", foodName));
}
public override void SetTable() {
Console.WriteLine("Pull plastic utensils out of the bag and put in a pile on the table.");
}
}
However, partial classes give you a lot of room for extensibility, and there
are a lot of other interesting features such as a built-in adapter, really
interesting designers, etc. Be sure to check out the article. You may
re-consider typed-DataSets in .NET 2.0. I know I have.