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.
From stackoverflow
-
There is a SetMaxResults method for ICriteria.
-
I can just use
public void GetByCriteria(ICriterion criterion) { var criteria= ISession.CreateCiteria(typeof(T)).SetMaxResults(maxResult); criteria.Add(criterion); }
0 comments:
Post a Comment