使用 nhibernate 进行划分会导致“无法确定成员来自”。
这可能很简单,但我似乎缺乏一些关于 nhibernate 如何工作的知识。这是我的代码:
ICriteria query = Session.CreateCriteria<TblProjectCategory>();
query = query.CreateCriteria<TblProjectCategory>(x => x.TblProjects)
.Add<TblProject>(x => x.FldCurrentFunding != 0m)
.Add<TblProject>(x => x.FldCurrentFunding / x.FldFundingGoal >= .8m)
.SetResultTransformer(
new NHibernate.Transform.DistinctRootEntityResultTransformer());
return query.List<TblProjectCategory>();
我得到的错误是:“无法确定 (x.FldCurrentFunding / x.FldFundingGoal) 的成员”
This is probably something simple but I seem to be lacking some knowledge of how nhibernate works. This is my code:
ICriteria query = Session.CreateCriteria<TblProjectCategory>();
query = query.CreateCriteria<TblProjectCategory>(x => x.TblProjects)
.Add<TblProject>(x => x.FldCurrentFunding != 0m)
.Add<TblProject>(x => x.FldCurrentFunding / x.FldFundingGoal >= .8m)
.SetResultTransformer(
new NHibernate.Transform.DistinctRootEntityResultTransformer());
return query.List<TblProjectCategory>();
The resulting error I get is: "Could not determine member from (x.FldCurrentFunding / x.FldFundingGoal)"
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
NHibernate 无法将表达式转换为 sql 语句,因为它不知道如何处理 x.FldCurrentFunding / x.FldFundingGoal。解决方案是将其重写为这样的表达式:
我希望这能给您一些指导
NHibernate is not able to translate the expression into a sql statement because is does not know what to do with x.FldCurrentFunding / x.FldFundingGoal. The solution is rewriting this to an expression like:
I hope this will give you some directions