你该怎么办寻呼与NHibernate?
问题描述:
例如,我要填充GridView控件在ASP.NET网页,只有必要的显示的行#的数据。怎样才能NHibernate的支持呢?
For example, I want to populate a gridview control in an ASP.NET web page with only the data necessary for the # of rows displayed. How can NHibernate support this?
答
的ICriteria有SetFirstResult(int i)以法,这表明的第一个项目,你希望得到(基本上是第一个数据行的页面)索引和SetMaxResult(int i)以指示的行数,你希望得到(例如,你的页面大小)。
ICriteria has a SetFirstResult(int i) method, which indicates the index of the first item that you wish to get (basically the first data row in your page) and SetMaxResult(int i) which indicates the number of rows you wish to get (e.g., your page size).
例如,此标准对象都将获得前10个结果的数据网格的:
For example, this criteria object gets the first 10 results of your data grid:
criteria.SetFirstResult(0).SetMaxResult(10);