zoukankan      html  css  js  c++  java
  • 配置Entity Framework连接Sql Server出现的一个异常

        异常:The Entity Framework provider type 'System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer' registered in the application config file for the ADO.NET provider with invariant name 'System.Data.SqlClient' could not be loaded. Make sure that the assembly-qualified name is used and that the assembly is available to the running application. See http://go.microsoft.com/fwlink/?LinkId=260882 for more information.

        方法1

          网上找到这样一个方法,在代码中添加:

          public void FixEfProviderServicesProblem()
          {
            //The Entity Framework provider type 'System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer'
            //for the 'System.Data.SqlClient' ADO.NET provider could not be loaded.
            //Make sure the provider assembly is available to the running application.
            //See http://go.microsoft.com/fwlink/?LinkId=260882 for more information.

            var instance = System.Data.Entity.SqlServer.SqlProviderServices.Instance;
          }

          本段代码并未使用;至于为什么会消除异常,还待深入了解。但这不是一个好的解决方法,它可能会引起另外一些问题。

         方法2

          在配置有Entity Framework的子项目中,有几个DLL如下:

          

          出现异常的原因主要是缺少了EntityFramework.DynamicFilters.dll、EntityFramework.SqlServer.dll、EntityFramework.SqlServer.xml。将这三个文件拷贝到主项目中,即可。

  • 相关阅读:
    js公共时间戳方法es6
    vue权限路由
    vue中websocket心跳写法
    vue引入全局组件和局部组件的区别以及全局注册公共函数
    [干货]关于vue作用域插槽的新的深入理解
    vue系统指令v-text(前端网备份)
    浏览器兼容html头部<meta>标签主要内容详情
    如何设置td中溢出内容的隐藏显示
    7-4列表/元组/字典/集合的内置方法
    7-3 整型/浮点型/字符串/列表常用方法
  • 原文地址:https://www.cnblogs.com/xuanxiaochen/p/5683660.html
Copyright © 2011-2022 走看看