var query = from b in ActiveRecordLinq.AsQueryable()
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();
Unfortunately, it seems that Linq to NHibernate does not support the C#Math class, so it gives me the following error:
Method Cos is not implemented
How can I bypass this?
Thank you!
Justin
> Implement it and submit a patch to NHibernate so that everyone can use your implementation
>Create a failed unit test, isolate the problem and submit it to NHibernate Jira and wait for others to implement it.
> Don’t use Linq, but use ordinary old sql or mixed hql for this query.
When you choose option 1, you will make some people happy.
In Linq to NHibernate, I am trying to return business users within a certain distance. This is what I have so far:
var query = from b in ActiveRecordLinq.AsQueryable()
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();
Unfortunately, it seems that Linq to NHibernate does not support the C#Math class, so it gives me the following error:
Method Co s not implemented
How can I bypass this?
Thank you!
Justin
You can do three things:
>implement it and submit a patch to NHibernate so that every Individuals can use your implementation
>Create a failed unit test, isolate the problem and submit it to NHibernate Jira and wait for others to implement it.
>Don’t use Linq, but use plain old sql or Mix hql for this query.
When you choose option 1, you will make some people happy.