How do I take the "top n" using NHibernate Criteria API? Ideally I'd like to use detached criteria.
How do I take the "top n" using NHibernate Criteria API?
Asked Answered
something like:-
criteria.SetFirstResult(1);
criteria.SetMaxResults(10);
Will take the first 10 results.
SetFirstResult is not needed unless you need to skip records/pages. –
Garvy
Doesn't work well when you have a one to many mapping for that entity. You can transform it after to get the dinctinct root entity but even still I'd like to be able to say, Nhibernate, give me the top 200 root entities with the hydrated children. –
Domiciliate
© 2022 - 2024 — McMap. All rights reserved.