2

任何人都可以配置以下示例代码吗?当我运行以下代码时,出现错误:

找不到具有不变名称“Devart.Data.SQLite”的 ADO.NET 提供程序的实体框架提供程序

在 Machine.config 中设置

<system.data>
    <DbProviderFactories>
      <add name="dotConnect for SQLite" invariant="Devart.Data.SQLite"
        description="Devart dotConnect for SQLite" type="Devart.Data.SQLite.SQLiteProviderFactory, Devart.Data.SQLite, Version=4.6.287.0, Culture=neutral, PublicKeyToken=09af7300eec23701" />
    </DbProviderFactories>
  </system.data>

在 app.config 中添加以下块代码后

<?xml version="1.0"?>
<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>
  <entityFramework>
    <providers>
      <provider invariantName="Devart.Data.SQLite" type="Devart.Data.SQLite.Entity.SQLiteEntityProviderServices, Devart.Data.SQLite.Entity, Version=4.6.287.0, Culture=neutral, PublicKeyToken=09af7300eec23701" >
        <migrationSqlGenerator type="Devart.Data.SQLite.Entity.Migrations.SQLiteEntityMigrationSqlGenerator, Devart.Data.SQLite.Entity, Version=4.6.287.0, Culture=neutral, PublicKeyToken=09af7300eec23701" />
      </provider>
    </providers>
  </entityFramework>
  <system.data>
    <DbProviderFactories>
      <remove invariant="Devart.Data.SQLite" />
      <add name="dotConnect for SQLite" invariant="Devart.Data.SQLite" description="Devart dotConnect for SQLite"
       type="Devart.Data.SQLite.SQLiteProviderFactory, Devart.Data.SQLite, Version=4.6.287.0, Culture=neutral, PublicKeyToken=09af7300eec23701" />
    </DbProviderFactories>
  </system.data>
  <connectionStrings>
    <add name="myContext" connectionString="Data Source=l:\newDB.db3;Version=3;" providerName="Devart.Data.SQLite" />
  </connectionStrings>
  <startup>
    <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5"/>
  </startup>
</configuration>

发生以下错误

'EFCodeFirst.MySQLiteContext' 的类型初始化程序引发了异常。

下载示例代码:

下载


信息:

Devart SQLite Code First (dotConnect for SQLite 4.6.287)

实体框架 6

VS 2013 预览版

4

1 回答 1

0

我们已经在我们的 dotConnect for SQLite 论坛上回答了您。

于 2013-09-26T12:52:41.997 回答