the 'outer' list is untyped, but everything within the list is typed...
check out how you can easily get around this awkwardness:
http://davybrion.com/blog/2008/06/the-query-batcher/

though i'd just use .Future<T> and .FutureValue<T> in case you're running on
the trunk... i never use MultiCriteria/MultiQuery directly anymore :P

On Tue, Mar 10, 2009 at 5:59 PM, TigerShark <[email protected]>wrote:

>
> Oh, and BTW, I have looked at MultiCriteria, but it seems it can't
> return typed resultsets. But if you don't manipulate the resultset and
> uses it to bind directly, it might be worth taking a look at that, as
> it can perform your task in a single db call.
>
> On 10 Mar., 17:57, TigerShark <[email protected]> wrote:
> > I usually perform a count on my criteria before performing any paging.
> > That way I issue two selects, one for the resultset count and another
> > for the actual resultset.
> >
> > Normally I do something like this:
> >
> > public IEnumerable<ResultObject> GetPagedResultSet(out int count,
> > QueryRange range, params Order[] orders) {
> >   var criteria = currentSession.CreateCriteria(typeof(ResultObject))
> >     .SetProjection(Projections.Count(Projections.Id()));
> >
> >   count = criteria.UniqueResult<int>();
> >
> >   criteria.SetProjection(null);
> >
> >   if(!QueryRange.IsNullOrEmpty(range)) {
> >     range.Apply(criteria);
> >   }
> >
> >   if(orders != null) {
> >     foreach(var order in orders) {
> >       criteria.AddOrder(order);
> >     }
> >   }
> >
> >   return criteria.List<ResultObject
> >
> > }
> >
> > The code above is from memory, and might be subject to your own
> > changes :)
> >
> > Furthermore the QueryRange class is one I have created to ease the
> > paging. I can post the code for it, if you'd like.
> >
> > On 10 Mar., 17:33, Robin Nadeau <[email protected]> wrote:
> >
> > > Is there a way to get the item count from the dataset when doing
> paging?
> >
> > > --
> > > Robin Nadeau, B.Eng.
> > > Software Developer
> >
>

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