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)"
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