Hi,
I am currently upgrading our application to NHibernate 1.2 but have encountered a problem that I could do
with some help with.
I need to create an ICriteria object
and do a RowCount on this (for use with a pager). I
then need to add a sort to this ICriteria and select
just 12 rows (start position depending on the selected page). The problem I seem to be having is that
once I have added Projection.RowCount() to the ICriteria I am unable to
remove this RowCount. Does anyone know of a way to remove
Projections?
I have supplied some example code to hopefully help to
explain what I need.
ICriteria q =
m_Query;
SearchContainer s = new
SearchContainer();
s.Count = (int)q.SetProjection(Projections.ProjectionList().Add(Projections.RowCount())).List()[0];
m_Pages =
(int)s.Count;
// I need to clear the ProjectionList
at this point
q =
GetSort(q, this.m_Sort,
this.m_SortDir);
q.SetMaxResults(m_VehiclesPerPage);
q.SetFirstResult(m_CurrentStartPage);
m_Vehicles = q.List();
Any assistance would be gratefully appreciated.
Cheers
Chris Knight
Web Applications Developer
![]()
Codeweavers Limited
11 Imex Technology Park
Stoke on
Staffordshire
ST4 8LJ
Tel: 0870 443 0888
Fax: 0870 443 0889
Registered in
This email and its
attachments are intended for the above named recipient(s) only and may contain
confidential information.
Any liability (in negligence, contract, or otherwise) arising as a result of
any third party taking any action on the basis of the information contained in
this email is hereby excluded.
The views of the author of this email may not reflect those of Codeweavers Ltd
or its associates. Codeweavers Ltd accepts no responsibility for the views,
statements, or opinions of the author.
Emails to and from us are monitored for operational reasons and in accordance
with lawful business practice.
Attachment: cid:image001.jpg@01C87E0B.1E8630F0