Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Accessing DbGeography methods/properties #134

Closed
czielin opened this issue Jan 4, 2018 · 5 comments
Closed

Accessing DbGeography methods/properties #134

czielin opened this issue Jan 4, 2018 · 5 comments

Comments

@czielin
Copy link
Contributor

czielin commented Jan 4, 2018

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!

@czielin
Copy link
Contributor Author

czielin commented Jan 4, 2018

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.

@czielin
Copy link
Contributor Author

czielin commented Jan 5, 2018

All right, testing was successful. I added a pull request.

@StefH
Copy link
Collaborator

StefH commented Jan 5, 2018

Thanks a lot!

@StefH StefH closed this as completed Jan 5, 2018
@czielin
Copy link
Contributor Author

czielin commented Jan 5, 2018

Wow, I see you created a new release already. Thanks!

@StefH
Copy link
Collaborator

StefH commented Jan 5, 2018

You are welcome!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants