Order by relation count in NHibernate
问题 I have a datastructure like this: public class User { public Guid Id {get;set;} public string Name {get;set;} public IList<Books> Books {get;set} } I have been struggeling with making it possible to sort the users by the count of bookmarks (one-to-many relation). I have tried various approaches with both linq, criteria and queryover, but with no luck, and therefore hope one of you could help. I am using paging, since I have quite a few users, so the solution needs to do the query on the SQL