使用 Castle ActiveRecord 从表中查找前 10 个结果
我试图获取我的应用程序用户的前 10 名分数。 我通常使用通常
User.SlicedFindAll(0, 10,
NHibernate.Expression.Expression.Eq("IsActive", true),
NHibernate.Expression.Order.Desc("Score")
用于分页目的的东西。 但是,我不想向我的请求添加任何约束(WHERE 子句)。 因此,我尝试了类似的操作,
User.SlicedFindAll(0, 10,
null,
NHibernate.Expression.Order.Desc("Score")
但这会引发 NullReferenceException。 有什么指点吗? (我猜 SlicedFindAll 不是一个好的选择)
谷歌在这方面没有提供帮助。
I'm trying to get say the top 10 scores for the users of my application. I'm usually using something along the lines of
User.SlicedFindAll(0, 10,
NHibernate.Expression.Expression.Eq("IsActive", true),
NHibernate.Expression.Order.Desc("Score")
which is usually used for pagination purposes. However, I don't want to add any constraint (WHERE clause) to my request. Hence I tried something along the lines of
User.SlicedFindAll(0, 10,
null,
NHibernate.Expression.Order.Desc("Score")
but this throws a NullReferenceException. Any pointers? (I guess SlicedFindAll is not a good choice)
Google didn't help on that one.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

您可以使用此重载:
在您的情况下它将是:
You can use this overload:
in your case it would be: