-
Notifications
You must be signed in to change notification settings - Fork 3.2k
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
Geometry.Buffer gets evaluated on client side instead of being translated into SQL #23764
Comments
Putting this on the backlog to do something specific for spatial types that will evaluate differently in geography/geometry. See also #23819 for a general mechanism to allow this to be changed. |
I would like to voice my support for some changes to the Spatial data types. The implementation using NetTopologySuite is problematic and trying to use .Net core with spatial types is a step back from the older .Net framework. The spatial support using Microsoft.SqlServer.Types is rock solid. Has there been any developments towards porting this to .Net core? |
@bmckilligan There have been some community efforts to port it to .NET Core. You can also use the .NET Framework assembly directly on .NET Core/5 so long as you stay on Windows. All of the spatial logic is implemented in a native library (SqlServerSpatial140.dll), and the P/Invoke's will work fine on .NET Core. The SQL Server team is aware of the gap and has a plan to address it, but I personally wouldn't (and didn't for EF Core 2.2) hold my breath. |
Note to implementor, use |
I looked at implementing this fix for this issue. While we can manage to avoid parameter extraction to evaluate In the meantime, as work-around
|
.Net Core needs to properly support SQL server geography and geometry data types. As a user trying to use geography data types this is a hot mess. |
@bmckilligan that's tracked by dotnet/SqlClient#30, and is not within the scope of EF Core, but rather SqlClient. Having said that, our experience with the NetTopologySuite library has been generally very good, and is probably superior to SqlGeometry/SqlGeography in various ways. |
It might be superior but IMHO the SqlGeometry/SqlGeography data types and functionality is a lot more intuitive. Having to deal with both the sql side of things and the NetTopologySuite is indeed a hot mess :( |
@UmairB as indicated above, this isn't something over which the EF team has control; please add your vote to the SqlClient issue tracking this. |
I have a table stores geo locations in SQL Server as
geography
type.I noticed that EF Core evaluates spatial operations if no column is involved. For example, the following code will produce an geometry in euclidean space (apparently not a valid
geography
) on client side and causes an ArgumentException:And the following code works because it can't be evaluted on client side:
There won't be any problem if database operates on
geometry
type which is the same as NTS.But if I need to operate on
geograhpy
, I have to be extra careful which statement is evaluated on client side and which is not.It would be nice if EF Core allows me to force all spatial operations to be evaludated on server side.
Version Info
EF Core version: 5.0
Database provider: Microsoft.EntityFrameworkCore.SqlServer
Target framework: .NET 5.0
The text was updated successfully, but these errors were encountered: