Spatial types and functions are not available for this provider

entity-framework-6 sql sql-server visual-studio-2015

Question

I have Visual studio 2015 community Edition with Update 3. I am using Entity Framework 6. On running the project on my local I am getting the error as shown in screen shot(https://puu.sh/uXFh0/64648902af.png). As in the code I am using c.Geography; its showing exception at that point.

I have Sql Server 2016 installed on my system with CLR Types as shown in below screen shot https://puu.sh/uXFqy/9f3c56a329.png

I also installed Sql server types using nuget package Install-Package Microsoft.SqlServer.Types.

Still no luck. what else can I do to solve the issue?

1
0
3/25/2017 5:49:27 AM

Popular Answer

You have multiple versions of the CLR types installed so you need to tell your application which version to use. Not sure what type of application it is but you need to either put these lines of code in your global.asax.cs (web app):

SqlServerTypes.Utilities.LoadNativeAssemblies(Server.MapPath("~/bin"));
SqlProviderServices.SqlServerTypesAssemblyName = "Microsoft.SqlServer.Types, Version=14.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91";

or else this in your desktop app prior to the spatial code running:

SqlServerTypes.Utilities.LoadNativeAssemblies(AppDomain.CurrentDomain.BaseDirectory);
SqlProviderServices.SqlServerTypesAssemblyName = "Microsoft.SqlServer.Types, Version=14.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91";
1
3/28/2017 3:57:23 PM


Related Questions





Related

Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow
Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow