Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Entity Framework cannot update database

My application crashes with the following error whenever I save to the DB.

Unable to find an entry point named 'SetClrFeatureSwitchMap' in DLL 'SqlServerSpatial110.dll'.

This error started yesterday afternoon after a Windows Update and PC Reboot. The dll is not referenced in the project and is not in the bin folder.

I use EF5 and I can connect to the DB and pull data but when I call ObjectContext.SaveChanges() the error occurs.

The application does not use geometry, so I have no idea where this is coming from.

like image 805
Atron Seige Avatar asked Dec 10 '15 14:12

Atron Seige


1 Answers

I had the same issue, and fixed it by adding the following lines to the web.config of my application:

<runtime>   <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">     <dependentAssembly>       <assemblyIdentity name="Microsoft.SqlServer.Types" publicKeyToken="89845dcd8080cc91" />       <bindingRedirect oldVersion="1.0.0.0-11.0.0.0" newVersion="10.0.0.0" />     </dependentAssembly>   </assemblyBinding> </runtime> 

This forces the EntityFramework to use the version 10 of the SqlServer.Types.dll, which doesn't have the Geometry type apparently.

like image 65
KdBoer Avatar answered Oct 05 '22 06:10

KdBoer