How to limit the number of rows returned in NHibernate?
I am looking for something like SetMaxResult(), but couldn't find it in Nhibernate namespace!
Note: I want to use NHibernate.Criterion
, not NHibernate.IQuery
, so it's best if you can provide that example.
I can just use
public void GetByCriteria(ICriterion criterion)
{
var criteria= ISession.CreateCiteria(typeof(T)).SetMaxResults(maxResult);
criteria.Add(criterion);
}
There is a SetMaxResults method for ICriteria.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With