I don't think you can use Futures with Linq, at least in this release.
But your query can be easily represented with Criteria:
var query = session.CreateCriteria(typeof(Style))
.SetFirstResult((page-1) * recsPerPage)
.SetMaxResults(recsPerPage)
.Future<Style>;
var count = session.CreateCriteria(typeof(Style))
.SetProjection(Projections.Count(Projections.Id()))
.FutureValue<int>;
Diego
On Tue, Nov 10, 2009 at 15:09, sk <[email protected]> wrote:
>
> Hello,
>
> I am using paging with L2N, everything works fine. However I also need
> the total count of **all** rows. I would like to make 1 request only
> though to the db. I found the following post from Ayende:
>
> http://ayende.com/Blog/archive/2009/04/27/nhibernate-futures.aspx
>
> My L2N looks very simple:
>
> var query = from styles in session.Linq<Style>()
> select styles;
>
> return query
> .Skip((page-1) * recsPerPage)
> .Take(recsPerPage)
> .ToList();
>
> Where would I implement FutureValue here?
>
> Thanks,
>
> >
>
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---