实体框架无法更新数据库 [英] Entity Framework cannot update database

查看:88
本文介绍了实体框架无法更新数据库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


无法找到名为SetClrFeatureSwitchMap的入口点DLL'SqlServerSpatial110.dll'。


这个错误是在Windows Update和PC重启后的昨天下午开始的。在项目中没有引用dll,而不是bin文件夹。



我使用EF5,我可以连接到数据库并拉数据,但是当我调用ObjectContext。 SaveChanges()发生错误。



应用程序不使用几何,所以我不知道这是从哪里来的。

解决方案

我有同样的问题,并通过将以下行添加到我的应用程序的web.config中来修复:

 <运行时间> 
< assemblyBinding xmlns =urn:schemas-microsoft-com:asm.v1>
< dependentAssembly>
< assemblyIdentity name =Microsoft.SqlServer.TypespublicKeyToken =89845dcd8080cc91/>
< bindingRedirect oldVersion =1.0.0.0-11.0.0.0newVersion =10.0.0.0/>
< / dependentAssembly>
< / assemblyBinding>
< / runtime>

这将强制EntityFramework使用SqlServer.Types.dll的版本10,有几何类型显然。


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.

解决方案

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.

这篇关于实体框架无法更新数据库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆