gpt4 book ai didi

c# - Entity Framework 4 不支持 SQLite

转载 作者:行者123 更新时间:2023-11-30 15:37:50 25 4
gpt4 key购买 nike

我正在使用 Entity Framework 4 代码优先方法自动创建 SQLite 数据库,我收到一条错误消息,告诉我 ProviderIncompatibleException:

[System.Data.ProviderIncompatibleException] = {"CreateDatabase is not supported by the provider."}

我认为 EF 4 支持它?

我在 app.config 中使用它:

<system.data>
<DbProviderFactories>
<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, Version=1.0.81.0, Culture=neutral, PublicKeyToken=db937bc2d44ff139" />
</DbProviderFactories>
</system.data>

谢谢。

最佳答案

代码优先(您提到的 CreateDatabase() 方法)和代码优先迁移(一种更新的代码优先开发方法)的支持是在某个 EF 提供程序的级别实现的。在 System.Data.SQLite 的情况下,所有这些功能都没有在提供者中实现。如果需要,您应该使用其他 EF 提供程序。例如,用于 SQLite 的 Devart dotConnect 支持 Code-FirstCode-First Migrations .

开发团队

关于c# - Entity Framework 4 不支持 SQLite,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12170334/

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