怎样在NHibernate中执行类似的SQL语句:select max(orderNo) as result from tRole??
获取最大序号的角色
#region 获取最大序号的角色
public Persistent.Role MaxOrderNoRole()
{
Persistent.Role result = new Role();
try
{
System.Collections.IList ilist = session.Find("from Role as a order by a.OrderNo desc");
if (ilist.Count != 0)
{
result = ilist[0] as Persistent.Role;
}
}
finally
{
session.Close();
}
return result;
}
#endregion
public Persistent.Role MaxOrderNoRole()
{
Persistent.Role result = new Role();
try
{
System.Collections.IList ilist = session.Find("from Role as a order by a.OrderNo desc");
if (ilist.Count != 0)
{
result = ilist[0] as Persistent.Role;
}
}
finally
{
session.Close();
}
return result;
}
#endregion