简体   繁体   English

如何解决 C# - SQlite 提供程序问题

[英]How to solve C# - SQlite provider problem

I have tried all the solutions but I get this error;我已经尝试了所有解决方案,但出现此错误;

System.NotSupportedException: 'Unable to determine the provider name for provider factory of type 'System.Data.SQLite.SQLiteFactory'. System.NotSupportedException:'无法确定类型为'System.Data.SQLite.SQLiteFactory'的提供者工厂的提供者名称。 Make sure that the ADO.NET provider is installed or registered in the application config.'确保在应用程序配置中安装或注册了 ADO.NET 提供程序。

I have installed all packages and dll's.我已经安装了所有的包和 dll。 picture of references参考图片

and my App.config;和我的 App.config;

<configuration>
  <configSections>
    <section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
  </configSections>

    <entityFramework>
     <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" />
      <add name="SQLite Data Provider" invariant="System.Data.SQLite" description=".NET Framework Data Provider for SQLite" type="System.Data.SQLite.SQLiteFactory, System.Data.SQLite" />
      <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" />
    </DbProviderFactories>
  </system.data>

<connectionStrings><add name="mainEntities" connectionString="metadata=res://*/Model1.csdl|res://*/Model1.ssdl|res://*/Model1.msl;provider=System.Data.SQLite.EF6;provider connection string=&quot;data source=C:\Users\MONS\Desktop\XmltoCsvBeta\XmltoCsvBeta\bin\Debug\Data\DB.db&quot;" providerName="System.Data.EntityClient" /></connectionStrings></configuration> ```

In case the error pops up at runtime why making selections it may mean that System.Data.SQLite.Linq package is missing in project's references.如果在运行时弹出错误,为什么选择它可能意味着System.Data.SQLite.Linq package 在项目的参考中丢失。 System.Data.SQLite includes support for LINQ so it is enough to install this one (instead of just System.Data.SQLite.Core ). System.Data.SQLite包括对 LINQ 的支持,因此安装这个就足够了(而不仅仅是System.Data.SQLite.Core )。

This helped in my case at least.这至少对我有帮助。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM