can anyone help me to create a paginated list with  filter and sort
criteria using CreateMultiCriteria,

my code is as follows

public IList<T> GetPagedData(int page, int pageSize, out long count)
         {
             try
             {
                 IList<T> all = new List<T>();

                 ISession s = NHibernateSession;
                 IList results =
s.CreateMultiCriteria()
                                     
.Add(s.CreateCriteria(typeof(T)).SetFirstResult(page).SetMaxResults(pageSize))
                                     
.Add(s.CreateCriteria(typeof(T)).SetProjection(Projections.RowCount()))
                                     .List();

                 foreach (Object o in (IList)results[0])
                     all.Add((T)o);

                 count = long.Parse((((IList)results[1])
[0]).ToString());
                 return all;
             }
             catch (Exception ex) { throw new
Exception("GetPagedData", ex); }
         }

-- 
You received this message because you are subscribed to the Google Groups 
"NHibernate Contrib - Development Group" 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/nhcdevs?hl=en.

Reply via email to