Visual Studio 2015使用EF6的CodeFirstFromDB模式操作Sqlite数据库时Provider问题

  什么是CodeFristFromDB

  

  问题:查询数据是遇到

“/”应用程序中的服务器错误。

No Entity Framework provider found for the ADO.NET provider with invariant name ‘System.Data.SQLite‘. Make sure the provider is registered in the ‘entityFramework‘ section of the application config file. See http://go.microsoft.com/fwlink/?LinkId=260882 for more information.

说明: 执行当前 Web 请求期间,出现未经处理的异常。请检查堆栈跟踪信息,以了解有关该错误以及代码中导致错误的出处的详细信息。 

异常详细信息: System.InvalidOperationException: No Entity Framework provider found for the ADO.NET provider with invariant name ‘System.Data.SQLite‘. Make sure the provider is registered in the ‘entityFramework‘ section of the application config file. See http://go.microsoft.com/fwlink/?LinkId=260882 for more information.

  解决方案

<?xml version="1.0" encoding="utf-8"?>
<!--
  有关如何配置 ASP.NET 应用程序的详细信息,请访问
  http://go.microsoft.com/fwlink/?LinkId=169433
  -->
<configuration>
  <configSections>
    <!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 -->
    <section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
  </configSections>
  <system.web>
    <compilation debug="true" targetFramework="4.0" />
  </system.web>
  <entityFramework>
    <defaultConnectionFactory type="System.Data.Entity.Infrastructure.LocalDbConnectionFactory, EntityFramework">
      <parameters>
        <parameter value="v13.0" />
      </parameters>
    </defaultConnectionFactory>
    <providers>
      <!--原本有的-->
      <provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" />
      <provider invariantName="System.Data.SQLite.EF6" type="System.Data.SQLite.EF6.SQLiteProviderServices, System.Data.SQLite.EF6" />
      <!--需要添加的-->
      <provider invariantName="System.Data.SQLite" type="System.Data.SQLite.EF6.SQLiteProviderServices, System.Data.SQLite.EF6" />
    </providers>
  </entityFramework>
  <system.data>
    <DbProviderFactories>
      <remove invariant="System.Data.SQLite.EF6" />
      <add name="SQLite Data Provider (Entity Framework 6)" invariant="System.Data.SQLite.EF6" description=".NET Framework Data Provider for SQLite (Entity Framework 6)" type="System.Data.SQLite.EF6.SQLiteProviderFactory, System.Data.SQLite.EF6" />
      <remove invariant="System.Data.SQLite" />
      <add name="SQLite Data Provider" invariant="System.Data.SQLite" description=".NET Framework Data Provider for SQLite" type="System.Data.SQLite.SQLiteFactory, System.Data.SQLite" />
    </DbProviderFactories>
  </system.data>
  <connectionStrings>
    <add name="JianBoShiContent" connectionString="data source=C:\Users\SHIHAO\Desktop\WebApplication1\WebApplication14\App_Data\JianBoShi.db" providerName="System.Data.SQLite.EF6" />
  </connectionStrings>
</configuration>

  

时间: 2024-08-25 16:34:26

Visual Studio 2015使用EF6的CodeFirstFromDB模式操作Sqlite数据库时Provider问题的相关文章

有感 Visual Studio 2015 RTM 简介 - 八年后回归 Dot Net,终于迎来了 Mvc 时代,盼走了 Web 窗体时代

有感 Visual Studio 2015 RTM 简介 - 八年后回归 Dot Net,终于迎来了 Mvc 时代,盼走了 Web 窗体时代 太阳火神的美丽人生 (http://blog.csdn.net/opengl_es) 本文遵循"署名-非商业用途-保持一致"创作公用协议 转载请保留此句:太阳火神的美丽人生 -  本博客专注于 敏捷开发及移动和物联设备研究:iOS.Android.Html5.Arduino.pcDuino,否则,出自本博客的文章拒绝转载或再转载,谢谢合作. 关于

Visual Studio 2015+CUDA8.0+CUDNN5配置Caffe-windows(BLVC)

综合  来源:Angle_Cal  2016-12-19 17:32  624℃  0评论 BLVC版本的Caffe-windows已经支持Visual Studio 2015,下面的配置过程是综合了其他人的经验而且验证过的,可以确保有效. 下载Caffe-Windows(BLVC) 下载地址:GitHub 下载好解压缩即可. 安装VS2015,CUDA,CUDNN,Anaconda,CMake VS2015 安装请自行完成,需要注意的是: ①如果你以前安装有早起的VS,那么安装VS2015可能

【转载】Visual Studio 2015 for Linux更好地支持Linux下的开发

原文:Visual Studio 2015 for Linux更好地支持Linux下的开发 英文原文:Targeting Linux Made Easier in Visual Studio 2015 Visual C++ for Linux 扩展使 Visual Studio 2015 的用户可以在 VS2015 中编写C或者 C++ 代码,并将代码部署到基于 Linux 的系统中去编译和调试.源代码和项目文件通过 SSH 传输到远程机上,程序的输出将显示在 Visual Studio 上.

VS2015--win32工程配置的一些想法之在 Visual Studio 2015 中进行调试的同时分析性能

出处: https://msdn.microsoft.com/zh-cn/magazine/dn973013(en-us).aspx 许多开发商花了绝大多数时间获取应用程序才能正常发挥作用.更少的时间里专注于应用程序的性能.虽然有了很长一段时间分析工具在 Visual Studio 中的,他们是单独的一组学习工具.许多开发人员没有花时间去学习和使用它们的时候会出现性能问题. 这篇文章将介绍 Visual Studio 2015 年新的诊断工具调试器窗口. 它还将描述如何使用它来分析性能作为定期调

使用Visual Studio 2015开发Android 程序

环境配置: 操作系统:win 7 64位 IDE:Visual Studio 2015 SDK:installer_r24.3.3-windows 安装前提: 编辑hosts文件(在附件可下载)因为安装过程中要联网更新和注册 安装完成VS之后直接新建android程序会提示: --------------------------- Microsoft Visual Studio --------------------------- 值不能为 null.参数名: path1 ----------

Visual Studio 2015和ASP.NET 5中可用的前端开发工具集

最近微软发布了一本白皮书,谈到了一些可以和Visual Studio 2015和ASP.NET 5配合使用的JS/前端Web开发工具(比如:函数库.任务执行器.框架等). 由于现在前端开发的生态系统在快速增长,也变得越来越复杂和庞大.所以,微软特意发布了这么一个白皮书来讲解一些可以集成到VS 2015用于ASP.NET 5开发的前端工具库.这些前端工具库,都能很好的被VS2015所支持,比如提供智能提示等内置特性. 每个涉及的工具库都给出了入门介绍.基本概念,以及在VS和ASP.NET中的用法.

Visual Studio 2015中的常用调试技巧分享

.NET 技术交流群:337901356 欢迎您的加入! 为什么要学习调试? 调试(Debug)是作为一个程序员必须要学会的东西,学会调试可以极大的提高开发效率,排错时间,很多人不喜欢调试,但我认为这是一个很不可取的选择,调试的时候能让我们看到程序的执行顺序.步骤以及过程等,调试的时候可以让我们监视代码中各个变量的情况,调试让我们可以让我们快速的找出错误的根源.可见调试是至关重要的. 要学习好怎么调试,那么必须去了解VS 这个IDE中的各种调试技巧,下面我就讲讲我所经常在调试程序中所用到的技巧.

Visual Studio 2015正式发布

Windows 10 RTM正式版要7月29日发布,微软的另一个重磅软件Visual Studio 2015已经率先发布,今天如期放出了正式版本.Visual Studio 2015包括许多新功能和更新,如通用Windows应用开发工具.面向iOS.Android.Windows的跨平台移动开发工具(包括Xamarin.Apache Cordova.Unity).可移植C++库.适用于Android的本机活动C++模板等等,对Cordova,Xamarin , C++的跨平台支持都非常好.让你通

ASP.NET5之客户端开发:Grunt和Gulp构建工具在Visual Studio 2015中的高效的应用

Grunt和Gulp是Javascript世界里的用来做自动压缩.Typescript编译.代码质量lint工具.css预处理器的构建工具,它帮助开发者处理客户端开发中的一些烦操重复性的工作.Grunt和Gulp都在Visual studio 2015中得到支持.ASP.NET 项目模板默认使用Gulp. Grunt和Gulp Grunt和Gulp有什么区别?Gulp虽然是稍微晚一点登场的,但是它因crisp performance和优雅的语法受到欢迎.与Grunt不同,Grunt往往在硬盘上是