如何在NHibernate中簡化下面的查詢?System.NotSupportedException:如何簡化NHibernate查詢?
以下是查找3種不同產品之間的最大值並按最大值對其排序的邏輯。
IQueryable<Property> results = ISession.Get<Property>();
results = from r in results
let pdts = new List<decimal?> { r.Prod1.Rate, r.Prod2.Rate, r.Prod3.Rate }
let max = pdts.Max()
orderby max
select r;
當執行它,NHibernate的拋出錯誤System.NotSupportedException
與exceptionMessage
「exceptionMessage」:「新列表
1() {Void Add(System.Nullable
1 [System.Decimal])([100001] .Prod1.Rate) ,太虛添加(System.Nullable1[System.Decimal])([100001].Prod2.Rate), Void Add(System.Nullable
1 System.Decimal])([100001] .Prod3.Rate)}」, 「exceptionType」: 「System.NotSupportedException」,
我如何簡化此查詢因爲邏輯是完美的T'
可以顯示所使用的變量的聲明和類型 –
'results'無非是IQueryable的''(什麼是'results'?)。一個物業有'Prod1','Prod2','Prod3'作爲其屬性 –
Karthik
好吧謝謝你,我要去看看我能否找到解決方案 –