Thanks Ken, I am a bit old fashion... I guess I will switch to HT as you suggested! Thanks again
Cheers, On Thu, Apr 2, 2009 at 3:56 PM, Ken Egozi <[email protected]> wrote: > DataSets and DataRelations? why on earth would you want that? > > Lists, Hashtable, Dictionary - these are your friends > > > > > > On Thu, Apr 2, 2009 at 10:34 AM, Eva Kan <[email protected]> wrote: > >> Many Thanks Ken, >> >> Many Thanks for your professional advice!! In fact, I am doing a project >> to load many instances (from different datasource) for a single class >> (because I need to add some business logic on each record for that class) >> >> my case is like: >> >> class Cat >> { >> property CatId Id; >> property CatId Nail; >> property CatId Eye; >> property CatId Legs; >> } >> >> My program to load 3 instances from 3 different datasource to Cat. So it >> creates 3 IList: >> >> IList1: Take Nail from instance1 >> IList2: Take Eye from instance2 >> IList3: Take Legs from instance3 >> >> in this case, do you think it is faster to convert all 3 instances to a >> DataSet and use DataRelation to link them using Id for forming a the final >> result? or I loop through all 3 instances and create the hashtables for >> getting the final result? >> >> the case is I am going to using dynamic binding (load the Assembly in >> runtime) to load the class to NHibernate. >> >> Cheers, >> Ka >> >> >> >> >> >> On Thu, Apr 2, 2009 at 2:49 PM, Ken Egozi <[email protected]> wrote: >> >>> looping on a small collection will be much faster (and consume less >>> memory) than using a dictionary access. >>> >>> and if the list is long then probably you do not want to load it all from >>> the DB anyway. >>> if you just *have* to load lots of items, and then locate by ID, just >>> take the loaded IList and build a Hashtable out of it, and you're done. >>> >>> >>> On Thu, Apr 2, 2009 at 7:33 AM, nhStarter <[email protected]> wrote: >>> >>>> >>>> Dear all, >>>> >>>> I am new to Nhibernate and found it extremely useful, I am now stuck >>>> in a situation: >>>> >>>> I would like to easily locate to a record in the IList by identifier >>>> (Id), I know IList only allows you to locate the record by index by >>>> default. >>>> >>>> Do you know if there is a better way rather than looping through the >>>> whole IList and assign to another collection for the fast accessing >>>> the record by identifier (Id)? >>>> >>>> I appreciate your professional advice very much in advance!! >>>> >>>> Cheers, >>>> Ka >>>> >>>> >>>> >>> >>> >>> >>> >>> -- >>> Ken Egozi. >>> http://www.kenegozi.com/blog >>> http://www.delver.com >>> http://www.musicglue.com >>> http://www.castleproject.org >>> http://www.gotfriends.co.il >>> >>> > > > -- > Ken Egozi. > http://www.kenegozi.com/blog > http://www.delver.com > http://www.musicglue.com > http://www.castleproject.org > http://www.gotfriends.co.il > > > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "nhusers" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/nhusers?hl=en -~----------~----~----~----~------~----~------~--~---
