I think you can use:

.Select(Projections.RowCount())
.List<int>();

... or use:

.RowCount()

Regards,
    Richard
  From: Tuna Toksoz 
  Sent: Monday, March 22, 2010 1:54 PM
  To: [email protected] 
  Subject: Re: [nhusers] How do I get row count using the NHibernate QueryOver 
api?


  isn't future for future queries, why do you need it ?

  Just execute the query.

  Tuna Toksöz
  Eternal sunshine of the open source mind.

  http://devlicio.us/blogs/tuna_toksoz
  http://tunatoksoz.com
  http://twitter.com/tehlike





  On Mon, Mar 22, 2010 at 2:04 PM, Jim Geurts <[email protected]> wrote:

    HI all,

    I'm using the QueryOver api that is part of NHibernate 3.x. I would
    like to get a row count, but the method I'm using returns all objects
    and then gets the count of the collection. Is there a way to just
    return an integer/long value of the number of rows without returning
    all of the row data?

    I'm currently using:

    _session.QueryOver<MyObject>().Future().Count()

    if it matters, that call is being used right after one like:

    _session.QueryOver<MyObject>().Skip(pageId-1 *
    PageSize).Take(PageSize).Future();

    Thanks for any help with this,

    Jim

    --
    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.





  -- 
  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.

-- 
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.

Reply via email to