Ramon is right, here's an example:

http://weblogs.asp.net/ricardoperes/archive/2011/11/06/nhibernate-pitfalls-querying-a-collection-count.aspx
 

For more elaborate querying without loading everything:

http://weblogs.asp.net/ricardoperes/archive/2012/01/18/querying-an-uninitialized-collection-with-nhibernate.aspx

Regards,

RP

On Tuesday, August 21, 2012 8:39:48 AM UTC+1, Ramon Smits wrote:
>
>
> Yes, mark the collection extra lazy... and then just do 
> class.Students.Length which will load load the student records but only 
> does a SELECT COUNT(*)
>
> On Mon, Aug 20, 2012 at 11:01 PM, Gustavo Souza Gonçalves <
> [email protected] <javascript:>> wrote:
>
>> Good afternoon everyone!
>>
>> I'm studying NHibernate, and decided to make some changes. Among them, I 
>> noticed that some fields are unnecessary. So I bring my doubt:
>> I have a list, let's call it Class_List within each study class, I can 
>> have N students for each class. Within the list Class_List, I also have 
>> other properties as simple as the name of the class.
>> How I see it is unnecessary to store how many students I have in the 
>> database, I would, in a single query, how many records I have. This, using 
>> NHibernate.
>>
>> Is this possible? How?
>>
>> -- 
>> You received this message because you are subscribed to the Google Groups 
>> "nhusers" group.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msg/nhusers/-/EA3iAvR1J0oJ.
>> To post to this group, send email to [email protected]<javascript:>
>> .
>> To unsubscribe from this group, send email to 
>> [email protected] <javascript:>.
>> For more options, visit this group at 
>> http://groups.google.com/group/nhusers?hl=en.
>>
>
>
>
> -- 
> Ramon
>
> 

-- 
You received this message because you are subscribed to the Google Groups 
"nhusers" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/nhusers/-/HyslgbEYzQkJ.
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.

Reply via email to