Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/276.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 无法确定类型为“;的提供程序工厂的提供程序名称;System.Data.Sqlite.SqliteFactory”;_C#_Entity Framework_Sqlite_Entity Framework 6 - Fatal编程技术网

C# 无法确定类型为“;的提供程序工厂的提供程序名称;System.Data.Sqlite.SqliteFactory”;

C# 无法确定类型为“;的提供程序工厂的提供程序名称;System.Data.Sqlite.SqliteFactory”;,c#,entity-framework,sqlite,entity-framework-6,C#,Entity Framework,Sqlite,Entity Framework 6,生成模型时发生意外异常。有关详细信息,请参见输出窗口。异常消息:“NotSupportedException:无法确定类型为“System.Data.SQLite.SQLiteFactory”的提供程序工厂的提供程序名称。确保已在应用程序配置中安装或注册ADO.NET提供程序。“ 当我尝试刷新模型(在edmx文件的设计器中)时,会出现上述错误。我创建了一个DB,但当我第一次得到这个异常时,我正试图添加一个表。现在,只需刷新模型就会导致异常。就我所知,我没有修改任何其他内容 我已经用谷歌搜索过了,

生成模型时发生意外异常。有关详细信息,请参见输出窗口。异常消息:“NotSupportedException:无法确定类型为“System.Data.SQLite.SQLiteFactory”的提供程序工厂的提供程序名称。确保已在应用程序配置中安装或注册ADO.NET提供程序。“

当我尝试刷新模型(在edmx文件的设计器中)时,会出现上述错误。我创建了一个DB,但当我第一次得到这个异常时,我正试图添加一个表。现在,只需刷新模型就会导致异常。就我所知,我没有修改任何其他内容

我已经用谷歌搜索过了,但我已经束手无策了

我使用的是VS2017、EF6和SQLite(我想是v3)

这是我的App.config:

<?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" />
    <!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 -->
  </configSections>
  <startup>
    <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.2" />
  </startup>
  <entityFramework>
    <defaultConnectionFactory type="System.Data.Entity.Infrastructure.LocalDbConnectionFactory, EntityFramework">
      <parameters>
        <parameter value="v13.0" />
      </parameters>
    </defaultConnectionFactory>
    <providers>
      <provider invariantName="System.Data.SQLite" type="System.Data.SQLite.EF6.SQLiteProviderServices, System.Data.SQLite.EF6"/>
      <provider invariantName="System.Data.SQLite.EF6" type="System.Data.SQLite.EF6.SQLiteProviderServices, System.Data.SQLite.EF6" />
      <provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" />
    </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="NavAidDBEntities" connectionString="metadata=res://*/NavAidModel.csdl|res://*/NavAidModel.ssdl|res://*/NavAidModel.msl;provider=System.Data.SQLite.EF6;provider connection string='data source=&quot;C:\SVN\SealiteSystems\NAM DB Manager\NAM DB.db&quot;'" providerName="System.Data.EntityClient" />
  </connectionStrings>
</configuration>

随Visual Studio 2017 15.7更新而来的EF 6.2存在一个问题,该问题阻止使用SQLite生成EDMX

解决方法是将以下内容添加到system.data->DbProviderFactorys部分的machine.config中

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

我在visual studio 2017版
15.7.5
上遇到了同样的问题。我做了每一件事,但没有任何效果。我认为这个问题会一直持续到版本
15.8.0
发布。一旦我将visual studio 2017版本更新为
15.9.12
(当前版本),现在就可以解决这个问题了

请在visual studio顶部找到黄色通知标志,单击此处并更新visual studio版本

<system.data>
    <DbProviderFactories>
    <add name="Microsoft SQL Server Compact Data Provider 4.0" invariant="System.Data.SqlServerCe.4.0" description=".NET Framework Data Provider for Microsoft SQL Server Compact" type="System.Data.SqlServerCe.SqlCeProviderFactory, System.Data.SqlServerCe, Version=4.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91" />
    <add name="SQLite Data Provider" invariant="System.Data.SQLite.EF6" description=".NET Framework Data Provider for SQLite" type="System.Data.SQLite.EF6.SQLiteProviderFactory, System.Data.SQLite.EF6, Version=1.0.108.0, Culture=neutral, PublicKeyToken=db937bc2d44ff139" />
    <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>