Do strongly typed datasets set performance?

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, ?

!

+3
6

, - , , , , .

MSDN, :

( DataSet DataSet), DataSet

, , Intellisense .

+7

, , , . , , .

. , int, null, .. IsMyfieldNull(), , , , . NULL, . .

+5

Intellisense. .

+4

DataSets - DataSet, . , DataSet , DataSet ( ).

+2

, . . . Intellisense, - , , " 1". , .

"linq, ". , .

+1

Yes, there is the advantage of using highly typed datasets - and this is from column searches. Finding a column by name is slower than finding a column by type. Code created for highly typed datasets searches for columns by type, so you get a bit of performance improvement.

+1
source

Source: https://habr.com/ru/post/1702918/


All Articles