在Linq到NHibernate我試圖返回一定距離內的用戶。以下是我迄今爲止:Linq到NHibernate - 方法Cos沒有實現
var query = from b in ActiveRecordLinq.AsQueryable<Business>()
where (3959 * Math.Acos(Math.Cos((Math.PI * coordinates.Latitude/180)) * Math.Cos((Math.PI * b.Latitude/180))
* Math.Cos((Math.PI * b.Longitude/180) - (Math.PI * coordinates.Longitude/180))
+ Math.Sin((Math.PI * coordinates.Latitude/180)) * Math.Sin((Math.PI * b.Latitude/180)))) <= radiusInMiles
orderby b.Name ascending
select b;
return query.ToList();
遺憾的是,似乎這樣它給了我下面的錯誤的C#數學類不Linq中支持NHibernate的:
方法的Cos不實施
我該如何解決這個問題?
謝謝! Justin
HQL只是您使用以下參數注入參數的動態sql:?我有這個工作,我只是希望避免這種方法。 – Justin 2010-07-05 22:44:15
HQL不是SQL。它是一種面向對象的查詢語言,語法非常類似於SQL。 – 2010-07-06 00:21:20
現已在3.3.3中實施。 https://nhibernate.jira.com/browse/NH-3092 – 2013-03-26 14:39:00