Where I work, we finally come up with the idea of using strongly typed datasets to encapsulate some of our queries in sqlserver. One of the ideas I advertised was the power of a strongly typed column, mainly in order not to throw any data. I am mistaken in thinking that strongly typed datasets will improve performance in the following situation, where there could potentially be thousands of rows?
Old way:
using(DataTable dt = sql.ExecuteSomeQuery())
{
foreach (DataRow dr in dt.Rows)
{
var something = (string)dr["something"];
var somethingelse = (int)dr["somethingelse"];
}
}
new way:
MyDataAdapter.Fill(MyDataset);
foreach (DataRow dr in MyDataset.MyDT.Rows)
{
var something = dr.Something;
var somethingelse = dr.SomethingElse;
}
If the properties really just do the casting backstage, I see how there will be no acceleration at all; it may take even longer before with the overhead of calling the function in the first place.
/ DataSets, ?
!