Id like some examples how to combine the query along with getting the
actual totalRecordCount for use in creating paged data results. Right
now I am issuing 2 queries, the first to get a count of the number of
rows satisfying the request (filter) and the second to get the actual
records for the requested page of data. Here is an example of how am I
using this now:

var query = from rd in Session.Query<RollupFwDriverDay>()
                from dg in Session.Query<DriverGroup>()
                where dg.Managers.Any(x => x.Id == filter.ManagerID)
                where dg.Drivers.Any(x => x.Id == rd.DriverBase.Id && 
!x.BDeleted)
                select rd;

query = query.FindByGridDataFilter(filter); //add any filters provided
from user input

// Record Count Query must preceed any Eager Fetch spec else NH
throws:
// NHibernate.QueryException: Query specified join fetching, but the
owner of the fetched association was not present in the select list
totalRecordCount = query.Count();
query = query.Fetch(x => x.DriverBase);
query = query.Fetch(x => x.LastDriverBase);
retObj = query.Page(filter.Page, filter.PageSize).ToList();

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