You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I recently added the Microsoft.EntityFrameworkCore.SqlServer.NetTopologySuite to work with the Point data structure, which represents the SQL Server geographic data type.
When I run a single query for an entity containing a Point property, the data is returned as expected.
When I run several queries together using EF+ deferred/future functions, I receive the error below.
Exception
An unhandled exception has occurred while executing the request.
System.IO.FileNotFoundException:
Could not load file or assembly 'Microsoft.SqlServer.Types, Version=10.0.0.0, Culture=neutral,
PublicKeyToken=89845dcd8080cc91'.
The system cannot find the file specified.
File name: 'Microsoft.SqlServer.Types, Version=10.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91'
at System.Reflection.RuntimeAssembly.<InternalLoad>g____PInvoke|49_0(NativeAssemblyNameParts*
__pAssemblyNameParts_native,
ObjectHandleOnStack __requestingAssembly_native, StackCrawlMarkHandle __stackMark_native,
Int32 __throwOnFileNotFound_native,
ObjectHandleOnStack __assemblyLoadContext_native,
ObjectHandleOnStack __retAssembly_native)
Example code
// Assume that Address is an entity containing a property with data type NetTopologySuite.Geometries.Point
// These queries would run successfully
var result1 = await Context.Set<Address>().Where(x => x.Id == 123).FirstOrDefaultAsync();
var result2 = await Context.Set<Address>().Where(x => x.Id == 456).FirstOrDefaultAsync();
// However, running as a deferred query will fail
var query1 = Context.Set<Address>().Where(x => x.Id == 123).DeferredSingleOrDefault().FutureValue();
var query2 = Context.Set<Address>().Where(x => x.Id == 456).DeferredSingleOrDefault().FutureValue();
var result1 = await query1.ValueAsync();
var result2 = await query2.ValueAsync();
We are currently getting an error that is different from yours. As we were not expecting an error about Microsoft.SqlServer.Types.
However, even if we find out why you get this error, the feature will still not work. We have some limitations in the way we created this feature. We need to eventually rewrite it to fix those limitations, but that's not currently in our short-term plans.
In short, we indeed have an issue with NetTopology for queries that use the Query Future, but it will not be fixed at this moment.
I have been running into this issue since NTS became the default for geospatial data in EF Core years ago. I have had to "downgrade" to a separate standalone query for objects that have geography data types, along with my future queries. Frustrating because I can't use it together with the other future queries it belongs with. I have been waiting patiently for this to be fixed, and I'm hoping that it finally makes its way to the short-term to-do list.
Description
I recently added the
Microsoft.EntityFrameworkCore.SqlServer.NetTopologySuite
to work with thePoint
data structure, which represents the SQL Servergeographic
data type.When I run a single query for an entity containing a
Point
property, the data is returned as expected.When I run several queries together using EF+ deferred/future functions, I receive the error below.
Exception
Example code
Stack
Z.EntityFramework.Plus.EFCore
v8.103.1Microsoft.EntityFrameworkCore.SqlServer
v8.0.7Microsoft.EntityFrameworkCore.SqlServer.NetTopologySuite
v8.0.7The text was updated successfully, but these errors were encountered: