简体   繁体   English

无法确定“System.Data.SQLite.SQLiteFactory”类型的提供程序工厂的提供程序名称。 使用Nuget包版本1.0.94.1

[英]Unable to determine the provider name for provider factory of type 'System.Data.SQLite.SQLiteFactory'. with the Nuget package version 1.0.94.1

I am getting this error with the Nuget package for SQLite 1.0.94.1. 我在SQLite 1.0.94.1的Nuget包中遇到此错误。 I fiddled around with the various app.config sections, helped by similar questions about previous versions of this package, but I cannot get it to work. 我对各种app.config部分进行了调整,有关此软件包以前版本的类似问题的帮助,但我无法使用它。 Below is the app.config as I found it after installing the Nuget package. 下面是我在安装Nuget包后找到的app.config。 I deleted the app.config prior to installing it. 我在安装之前删除了app.config。 I only added the connectionstrings after that. 之后我才添加了连接字符串。

So, where is the problem?? 那么,问题出在哪里?

<?xml version="1.0" encoding="utf-8"?>
<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>
  <!--Added by me, the rest of the app.config was constructed by installing the SQLite package -->
  <connectionStrings>
    <add name="PrivateMessengerContext"  connectionString="DataSource=|DataDirectory|\PrivateMessengerDb.db" providerName="System.Data.SQLite.EF6"/>
    <add name="PasswordContext" connectionString="DataSource=|DataDirectory|\PasswordDb.db" providerName="System.Data.SQLite.EF6"/>
  </connectionStrings>
  <system.data>
    <!--
        NOTE: The extra "remove" element below is to prevent the design-time
          support components within EF6 from selecting the legacy ADO.NET
          provider for SQLite (i.e. the one without any EF6 support).  It
          appears to only consider the first ADO.NET provider in the list
          within the resulting "app.config" or "web.config" file.
    -->
    <DbProviderFactories>
      <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" />
      <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>
  <entityFramework>
    <defaultConnectionFactory type="System.Data.Entity.Infrastructure.LocalDbConnectionFactory, EntityFramework">
      <parameters>
        <parameter value="mssqllocaldb" />
      </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" />
    </providers>
  </entityFramework>
</configuration>

Add one more provider 再添加一个提供商

<provider invariantName="System.Data.SQLite" type="System.Data.SQLite.EF6.SQLiteProviderServices, System.Data.SQLite.EF6" />

move 移动

<add name="SQLite Data Provider" invariant="System.Data.SQLite" description=".NET Framework Data Provider for SQLite" type="System.Data.SQLite.SQLiteFactory, System.Data.SQLite" />

bellow 怒吼

<remove invariant="System.Data.SQLite" />

and change the provider name to providerName="System.Data.SQLite in your connection string. 并将提供程序名称更改为您的连接字符串中的providerName="System.Data.SQLite

EDIT : See also http://system.data.sqlite.org/index.html/tktview/2be4298631c01be99475 编辑 :另见http://system.data.sqlite.org/index.html/tktview/2be4298631c01be99475

What worked for me was to follow the comment on 2015-04-29 08:33:33 in the SQLite ticket : 对我有用的是遵循SQLite票证中 2015-04-29 08:33:33的评论:

If you switch project target platform from 4.5.1 to 4 and reinstall nuget package you will have it all working(even if you later return it back to 4.5.1)" 如果您将项目目标平台从4.5.1切换到4并重新安装nuget包,您将完成所有工作(即使您稍后将其返回到4.5.1)“

Might have a similar effect on config to Mihail's answer, not sure. 可能会对配置Mihail的答案产生类似的影响,不确定。

暂无
暂无

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

相关问题 使用SQLite的log4net:InvalidCastException:无法将类型为“ System.Data.SQLite.SQLiteFactory”的对象转换为类型为“ System.Data.IDbConnection”的对象 - log4net with SQLite: InvalidCastException: Unable to cast object of type 'System.Data.SQLite.SQLiteFactory' to type 'System.Data.IDbConnection' EF 6 的 SqlClientFactory 错误-无法确定提供程序工厂的提供程序名称 - SqlClientFactory error with EF 6 - Unable to determine the provider name for provider factory System.Data.SQLite数据提供程序丢失 - System.Data.SQLite Data Provider Missing 无法确定类型为“ Oracle.DataAccess.Client.OracleConnection”的连接的提供程序名称 - Unable to determine the provider name for connection of type 'Oracle.DataAccess.Client.OracleConnection' 错误 - 无法加载具有不变名称“System.Data.SQLite.EF6”的ADO.NET提供程序 - Error - ADO.NET provider with invariant name 'System.Data.SQLite.EF6' could not be loaded 具有不变名称“System.Data.SQLite.EF6”的 ADO.Net 提供程序未在机器或应用程序配置文件中注册 - The ADO.Net provider with Invariant name 'System.Data.SQLite.EF6' is not registered in the machine or application config file 安装和使用System.Data.SQLite(一个ADO.NET提供程序) - Installing and Using System.Data.SQLite (An ADO.NET provider) NuGet 找不到package的版本 - NuGet unable to find the version of a package 没有为ADO.NET提供程序找到具有不变名称“System.Data.SqlClient”的实体框架提供程序。 - No Entity Framework provider found for the ADO.NET provider with invariant name 'System.Data.SqlClient'. 错误:找不到具有不变名称'System.Data.SqlClient'的ADO.NET提供程序的实体框架提供程序 - Error: No Entity Framework provider found for the ADO.NET provider with invariant name 'System.Data.SqlClient'
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM