Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Languages / C# / March 2008

Tip: Looking for answers? Try searching our database.

LINQ, Hashtables and Business Layer

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Jake McCool - 18 Mar 2008 10:38 GMT
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
Jon Skeet [C# MVP] - 18 Mar 2008 11:26 GMT
> I have a performance query regarding LINQ that I would like some opinions.
>
[quoted text clipped - 14 lines]
> 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.

Signature

Jon Skeet - <skeet@pobox.com>
http://www.pobox.com/~skeet   Blog: http://www.msmvps.com/jon.skeet
World class .NET training in the UK: http://iterativetraining.co.uk

Jake McCool - 18 Mar 2008 11:31 GMT
Thanks Jon,

do you know what the performance implications would be by comparison to a
DataReader?

>> I have a performance query regarding LINQ that I would like some
>> opinions.
[quoted text clipped - 20 lines]
> A call to ToDictionary would seem the obvious choice, specifying a
> lambda expression which pulls out the GUID as the key.
Jon Skeet [C# MVP] - 18 Mar 2008 11:38 GMT
> 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.

Signature

Jon Skeet - <skeet@pobox.com>
http://www.pobox.com/~skeet   Blog: http://www.msmvps.com/jon.skeet
World class .NET training in the UK: http://iterativetraining.co.uk


Rate this thread:







Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.