The error says it all - don't use Convert.ToDouble.
A regular cast should work:
((double)htl.Value.Longitude)

On Wed, Nov 13, 2024 at 1:01 PM Charlin S <charli...@hotelhub.com> wrote:

> Hi,
> Thanks for your email.
> tried with == and works but getting error when I add more conditions
> ar compiledQuery = CompiledQuery.Compile((string _CountryCode,double
> _fromLongitude,double _fromLatitide,double _KmsDistance,double _pi,double
> _sin,double _cos,double _piDivide) => HotelsIcache.AsCacheQueryable().
> Where(htl=> htl.Value.CountryCode ==  _CountryCode
>       &&(((Math.Acos(_sin * Math.Sin(Convert.ToDouble(htl.Value.Latitude)
> * _pi) + _cos
>         * Math.Cos(Convert.ToDouble(htl.Value.Latitude) * (_pi)) * Math.
> Cos((_fromLongitude - Convert.ToDouble(htl.Value.Longitude)) * _pi)) *
> _piDivide) * 60 * 1.1515)* 1.609344)<=_KmsDistance)
>
>        );
>       IQueryCursor<ICacheEntry<string,TestModel>> cursor = compiledQuery(
> CountryCode, fromLongitude, fromLatitide,KmsDistance,pi,sin,cos,piDivide);
>
> Error:
> An exception of type 'System.NotSupportedException' occurred in
> Apache.Ignite.Linq.dll but was not handled in user code: 'Method not
> supported: System.Convert.(Double ToDouble(System.Object))'
> Regards,
> Charlin
>
> On Wed, 13 Nov 2024 at 12:21, Pavel Tupitsyn <ptupit...@apache.org> wrote:
>
>> Hi, try == instead of string.Equals
>>
>> On Wed, 13 Nov 2024, 08:38 Charlin S, <charli...@hotelhub.com> wrote:
>>
>>> Hi All,
>>> Ignite LINQ compiledquery having below error. please suggest me to make
>>> it work
>>> Exception has occurred: CLR/System.NotSupportedException
>>>
>>>    -
>>>
>>> An exception of type 'System.NotSupportedException' occurred in
>>> Apache.Ignite.Linq.dll but was not handled in user code: 'Method not
>>> supported: System.String.(Boolean Equals(System.String, System.String))'
>>> [image: image.png]
>>> Sample code
>>> var compiledQuery = CompiledQuery.Compile((string _CountryCode,double
>>> _KmsDistance) => TestIcache.AsCacheQueryable().Where(htl=> string.Equals
>>> (htl.Value.CountryCode, _CountryCode) ));
>>> IQueryCursor<ICacheEntry<string, TestModel>> cursor = compiledQuery(
>>> CountryCode,KmsDistance);
>>> var result1 = cursor.ToArray();
>>> Regards,
>>> Charlin
>>>
>>>

Reply via email to