转载:http://www.cnblogs.com/tenghoo/archive/2011/02/14/1954393.html
- NHibernate专题:http://kb.cnblogs.com/zt/nhibernate/
- NHibernate官方站点:http://nhforge.org/
- NHibernate参考文档:http://nhforge.org/doc/nh/en/
- 获取NHibernate地址:http://sourceforge.net/projects/nhibernate/
public IList<Orders> GetUserOrderByUserID(string userid, int PageIndex, int PageSize, out long count)
{
using (ISession _session = base.GetSession())
{
var hql = "select count(*) from Orders where userid=:userid";
IQuery query = _session.CreateQuery(hql);
query.SetString("userid", userid);
object obj = query.UniqueResult();
long.TryParse(obj.ToString(), out count); var list = from p in _session.Linq<Orders>()
.Where(p => p.UserID == userid)
.OrderByDescending(p => p.Otime)
.Skip((PageIndex - ) * PageSize)
.Take(PageSize)
select p; return list.ToList<Orders>();
}
}
NHibernate分页的测试
http://www.cnblogs.com/chenyt/archive/2010/12/04/nhibernate.html