These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 
Author Message
 Post subject: IList<> vs List<>
PostPosted: Thu Dec 21, 2006 10:43 am 
Beginner
Beginner

Joined: Thu Jun 01, 2006 11:27 am
Posts: 28
Is possible that criteria List method return a List instead an IList??

I have the following code to retrieve the list, but after retrieve in the UI layer I want to use Find methods over the list, but that method belongs to List class and not to IList.

IList<MyClass> list = criteria.List<MyClass>();


Any recommendation?


Top
 Profile  
 
 Post subject: new List
PostPosted: Thu Dec 21, 2006 3:06 pm 
Beginner
Beginner

Joined: Thu Apr 27, 2006 12:19 pm
Posts: 33
Location: Seattle, WA
NHibernate only returns interfaces to collections: IList, ISet, IDictionary. This is done because the actual implementations returned from NHibernate may change depending on your mapping files etc. I ran into the same problem when I wanted to run a sort on an IList (even though I probably should have done this on the database side). I ended up creating a copy of the IList that NHibernate returned:

Code:
List<User> usersList = new List<User>(usersIList);


Top
 Profile  
 
 Post subject:
PostPosted: Fri Dec 22, 2006 3:00 pm 
Senior
Senior

Joined: Sat Sep 10, 2005 3:46 pm
Posts: 178
I thought I read somewhare that there was a way to configure Nhibernate, through the mapping files, to use a concrete implementation of a List. Was I dreaming this or is this capability actually out there?


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
cron
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.