Accessing DbGeography methods/properties
I am now working on querying some fields that are mapped via Entity Framework to the Sql Server geography type. The following two queries:
queryable.Where("p.any(c.geographic.Union(@0).Area == 0)", parameters.ToArray()); queryable.Where("p.any(@0.Difference(c.geographic).IsEmpty)", parameters.ToArray());
result in the following error:
System.Linq.Dynamic.Core.Exceptions.ParseException: 'Methods on type 'DbGeography' are not accessible'
A simple geographic query, like the following, works as expected:
p.any(c.geographic.Intersects(@0))
The parameters object contains a single DbGeography object.
Are the above two queries expected to work? Do I maybe again have the incorrect query syntax?
Thanks!
It will take me a bit to build some proper tests around it, but I added the following to the predefined types, and the above queries appear to be translating to proper TSQL now.
_predefinedTypesHelper.TryAdd("System.Data.Entity.Spatial.DbGeography, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089", 2);
Once I've had a chance to test some more I'll create a pull request for this.
@StefH thanks for your prior tip on getting the solution to properly build. Turns out it came in handy.
All right, testing was successful. I added a pull request.
Thanks a lot!
Wow, I see you created a new release already. Thanks!
You are welcome!