简体   繁体   中英

How Configure Devart dotConnect for SQLite Code First?

Can anyone configure the following sample code ? When I run the following code, I get the error :

No Entity Framework provider found for the ADO.NET provider with invariant name 'Devart.Data.SQLite'

Setting in 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>

after add below block code in 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>

following error occurs

The type initializer for 'EFCodeFirst.MySQLiteContext' threw an exception.

Download Sample Code :

Download


INFO :

Devart SQLite Code First (dotConnect for SQLite 4.6.287)

Entity Framework 6

VS 2013 Preview

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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