This is how I do it maybe this could help you:
var count =*
CriteriaTransformer.TransformToRowCount*(detachedCriteria);
// detachedCriteria with many filters.
detachedCriteria
.SetFirstResult(@params.Paging.PageSize *
(@params.Paging.CurrentPage < 1 ? 0 : @params.Paging.CurrentPage - 1))
.SetMaxResults(@params.Paging.PageSize);
var session = sm.OpenSession();
ICriteria select =
detachedCriteria.GetExecutableCriteria(session);
IEnumerable<Case> cases = select.*Future*<Case>();
ICriteria countCriteria = count.GetExecutableCriteria(session);
IFutureValue<int> total = countCriteria.*FutureValue*<int>();
On Fri, Sep 3, 2010 at 11:37 PM, Fabio Maulo <[email protected]> wrote:
> I mean... create first the query for the result of the page and then use
> ConvertToRowCount to have the query for rowcount query.
>
>
> On Fri, Sep 3, 2010 at 11:35 PM, Fabio Maulo <[email protected]> wrote:
>
>> do the inverse.
>> Create a query with the projection and then use ConvertToRowCount to have
>> the query for rowcount query.
>>
>>
>> On Fri, Sep 3, 2010 at 9:11 PM, Craig van Nieuwkerk <[email protected]>wrote:
>>
>>> I don't have full objects already. The first projection is to do a
>>> count of total records, the second one is to get the results for the
>>> current page (40 records).
>>>
>>> On Sat, Sep 4, 2010 at 10:07 AM, Tuna Toksoz <[email protected]> wrote:
>>> > why do you go to db if you have full objects already? linq to objects
>>> would
>>> > do this?
>>> >
>>> > Tuna Toksöz
>>> > Eternal sunshine of the open source mind.
>>> >
>>> > http://devlicio.us/blogs/tuna_toksoz
>>> > http://tunatoksoz.com
>>> > http://twitter.com/tehlike
>>> >
>>> >
>>> >
>>> >
>>> > On Fri, Sep 3, 2010 at 7:07 PM, Craig van Nieuwkerk <[email protected]
>>> >
>>> > wrote:
>>> >>
>>> >> I did set it to run a query and then I want to remove it and run the
>>> >> query again. I made a work around to fix it, made a copy of the query
>>> >> before setting the projections.
>>> >>
>>> >> On Sat, Sep 4, 2010 at 5:32 AM, Diego Mijelshon <
>>> [email protected]>
>>> >> wrote:
>>> >> > How about not setting it? :-)
>>> >> >
>>> >> > Diego
>>> >> >
>>> >> >
>>> >> > On Thu, Sep 2, 2010 at 20:27, Craig van Nieuwkerk <
>>> [email protected]>
>>> >> > wrote:
>>> >> >>
>>> >> >> In nHibernate 2.0.1 I could call the SetProjection method of
>>> ICriteria
>>> >> >> passing null as the parameter and it would clear the projections.
>>> >> >> Since upgrading to nHibernate 2.1 this now raises an exception.
>>> >> >>
>>> >> >> How can I clear the projections in 2.1?
>>> >> >>
>>> >> >> Craig.
>>> >> >>
>>> >> >> --
>>> >> >> 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]<nhusers%[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]<nhusers%[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]<nhusers%[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]<nhusers%[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]<nhusers%[email protected]>
>>> .
>>> For more options, visit this group at
>>> http://groups.google.com/group/nhusers?hl=en.
>>>
>>>
>>
>>
>> --
>> Fabio Maulo
>>
>>
>
>
> --
> Fabio Maulo
>
> --
> 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]<nhusers%[email protected]>
> .
> For more options, visit this group at
> http://groups.google.com/group/nhusers?hl=en.
>
--
Román
--
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.