Visual Studio 2015使用EF6的CodeFirstFromDB模式操作Sqlite資料庫時Provider問題

來源:互聯網
上載者:User

標籤:

  什麼是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>

  

Visual Studio 2015使用EF6的CodeFirstFromDB模式操作Sqlite資料庫時Provider問題

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.