NHibernate ICriteria - 按子集合计数排序?
这是一个简单的示例场景 -
一个“标签”有许多“问题”。当我获取标签列表时,如何使用 Criteria API 按标签问题计数进行排序?
我以前做过这个,但大约 4 个月没有碰过 NH 并且忘记了......也许是预测?帮助!!!
谢谢
Here is a simple example scenario -
A 'Tag' has many 'Questions'. When I get a list of Tags how do I order by the Tags Question Count using the Criteria API?
I have done this before but haven't touched NH in about 4 months and have forgotten... projections maybe? help!!!
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
坐下来用一双新的眼睛找出答案...标签现在按标签问题集合(视图)上的属性排序..这在我的领域比按儿童数量排序更有意义
Sat down with a fresh pair of eyes and figured it out... Tags are now ordered by a propery on the Tags Question collection (views).. which made alot more sence in my domain than ordering by the count of children
尝试:
编辑:除非您决定反对它或者您已经熟悉 Criteria API,否则您应该查看 HQL 或 NHibernate.Linq:
Linq to NHibernate:巨大的改进。
Try:
Edit: Unless you're deciding against it or your already comfortable with the Criteria API, you should take a look at either HQL or NHibernate.Linq:
Linq to NHibernate: a vast improvement.