-
Notifications
You must be signed in to change notification settings - Fork 54
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
Microsoft.SqlServer.Types not supported in .net standard 2.0 #84
Comments
Additionally: when using the .net standard 2.0 version of System.Data.SqlClient, selecting back geo-type fields results in an exception: |
Looks like NetToplogySuite is addressing this: |
I've been noodling around trying to get NHibernate.Spatial.MySQL working with the new MySQL.Data 8.0.11 driver in a .Net Core project. I got fluent mapping and schema generation working without much trouble. However, one snag I have run into is a change in the GeoAPI IGeometry interface from 1.7.4 to 1.7.5 (still in preview):
The difference being
I did a quick run with the portability analyzer, and it seems NHibernate.Spatial should be fairly straightforward to port to .Net Core. The NHibernate and NetTopologySuite teams already did the heavy lifting for us. So according to Microsoft, the way to go about porting a project to .Net Core is to create new .Net Core projects and move the code files to the new projects. So I am considering giving this a go and try to bring atleast NH.Spatial.MySQL and NH.Spatial.PostGIS over to .Net Core. I haven't looked into @dotMorten's implementation in detail yet, but that may even help us getting NH.Spatial.MsSql ported as well. What do you guys think? |
I'm curious why you're porting to .NET Core instead of .NET Standard? (Since that'll hit more platforms, including .NET Core) |
I also ran into the I've created a new issue for supporting .NET Standard (see #96). |
Has anyone looked into this issue since last year? I am currently trying to port an application from .net framework to .net core running on Linux and I am trying to figure out how to proceed. |
@MuhKuh7 We're still waiting for Microsoft to release a .NET Standard (or .NET Core on all platforms) compatible version of Microsoft.SqlServer.Types - you can follow the issue here: dotnet/SqlClient#30 For anyone targeting .NET Core on Windows only, we could use the workaround suggested by @dotMorten here, but that wouldn't help in your case anyway since you are targeting .NET Core on Linux. |
@peetw I was just trying to replace Microsoft.SqlServer.Types with the version from @dotMorten, but the implementation of the Populate method is missing. Does it even make sense to try to use this as a replacement or do you know of someone who has already tried that? If it would be only that method the implementation would probably be not that hard, but I just started to look into this so I do not have the full picture yet ;) Otherwise I will need to look into replacing the database server with PostreSQL using PostGIS. Might be less work. It is strange that Microsoft pushes Linux everywhere and even provides their SQL Server Docker images based on Linux, but on the other hand the support for essential libraries seems to be low priority :( |
I haven't looked into this really, but I stumbled across this info: dotnet/core#2273 (comment) |
@CoffeeCodes, this looks promising! It is far from complete. Currently geography types are ignored. And I am stuck with the user defined type. I used a simple binary, but this prevents the use of functions and stops with "Cannot call methods on binary". Maybe someone else has more experience with SQL Server and would like to follow up on that idea? |
@MuhKuh7 I've created a pre-release of |
@peetw, thx! I will try it asap. |
@MuhKuh7 did you get a chance to test the pre-release package? |
@peetw, I am on vacation, but can test next week. |
@peetw, totally forgot to answer here. The pre-release version works perfectly since several weeks in our application running .net core 2.2 on Debian Stretch |
No worries, thanks for getting back to us - good to hear it's working for you! I'm away for the next two weeks, but I'll try and get a full release out once I return (need to add tests and Linux CI builds first though) |
Anyone else having issues saving large polygon geometries? |
@mikemcdougall what issues are you having exactly? Do you have a test case you can share? |
@peetw the SqlDBType.Binary has a max of 8000 bytes. So the value being passed in the parameter was being cut off. Sql server was sending back invalid geometry error. Seems to be working with the above changes. Would you like me to create PR? |
@mikemcdougall Great, nice work! I'll try and take a look at the PR ASAP. |
@mikemcdougall I've created a new issue for the large geometry problem: #114 Closing this issue as the main work in migrating the |
So I just spent two days trying to Nhibernate.Spatial to run under a .net standard 2.0 app. There were several issues but the primary one has to do with the serialization of sql geometry/geography types. It just doesn't work because some of the underlying serializers aren't in the .net standard 2.0 version of System.Data. Nothing I did was able to get them to reliably load the full-framework version of system.data.
If I can work out a way to reliably read and write sql server geo-types without the dependence on the Microsoft.SqlServer.Types library would that be an acceptable solution?
The text was updated successfully, but these errors were encountered: