[英]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' 未找到具有不变名称“ Devart.Data.SQLite”的ADO.NET提供程序的实体框架提供程序
Setting in Machine.config 在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 在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. “ EFCodeFirst.MySQLiteContext”的类型初始值设定项引发了异常。
Download Sample Code : 下载示例代码:
INFO : 信息:
Devart SQLite Code First (dotConnect for SQLite 4.6.287) Devart SQLite代码优先(适用于SQLite 4.6.287的dotConnect)
Entity Framework 6 实体框架6
VS 2013 Preview VS 2013预览
我们已经在dotConnect for SQLite论坛上回答了您。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.