gpt4 book ai didi

c# - 如何首先为 SQLite 代码配置 Devart dotConnect?

转载 作者:太空宇宙 更新时间:2023-11-03 16:06:55 26 4
gpt4 key购买 nike

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

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

在 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>

出现以下错误

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

下载示例代码:

Download


信息:

首先开发 SQLite 代码(用于 SQLite 4.6.287 的 dotConnect)

Entity Framework 6

VS 2013 预览

最佳答案

我们已通过 our dotConnect for SQLite forum 回复您.

关于c# - 如何首先为 SQLite 代码配置 Devart dotConnect?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18998212/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com