LINQ, Hashtables and Business Layer

  • Thread starter Thread starter Jake McCool
  • Start date Start date
J

Jake McCool

Hello people,

I have a performance query regarding LINQ that I would like some opinions.

Currently we have a business logic framework that is used in n-tier
applications. We read data from a database using a data reader and use this
information to populate a set of business objects.

Our business data is identified by a GUID so we create hashtables for
collections of business objects with the GUID as the key and the business
object itself as the object.

The data manipulation we do uses lots of lookups from these hashtables,
which is simple and really fast because of the hashing. We want to start
using LINQ but we can't find a way of manually piping the data into a
hashtable.

So the question is, is there a way of getting the LINQ data into a hashtable
or is there another way of achieveing the same speed of lookup via LINQ
functionality?

Cheers

JS
 
Jake McCool said:
I have a performance query regarding LINQ that I would like some opinions.

Currently we have a business logic framework that is used in n-tier
applications. We read data from a database using a data reader and use this
information to populate a set of business objects.

Our business data is identified by a GUID so we create hashtables for
collections of business objects with the GUID as the key and the business
object itself as the object.

The data manipulation we do uses lots of lookups from these hashtables,
which is simple and really fast because of the hashing. We want to start
using LINQ but we can't find a way of manually piping the data into a
hashtable.

So the question is, is there a way of getting the LINQ data into a hashtable
or is there another way of achieveing the same speed of lookup via LINQ
functionality?

A call to ToDictionary would seem the obvious choice, specifying a
lambda expression which pulls out the GUID as the key.
 
Thanks Jon,

do you know what the performance implications would be by comparison to a
DataReader?
 
Jake McCool said:
do you know what the performance implications would be by comparison to a
DataReader?

Unlikely to be significant, particularly if you use compiled queries.
However, the best way to find out is to try it and measure.
 
Back
Top