Foreign key support in SQLite3(SQLite3 中的外键支持)
问题描述
根据 2010 年的 this 线程,EnforceFKConstraints"连接string 属性应该在 SQLite 的未来版本中实现.有谁知道开发人员是否已经开始这样做了?
According to this thread from 2010, an "EnforceFKConstraints" connection string property was supposed to be implemented into future releases of SQLite. Does anyone know if the developers have gotten around to doing that?
如果没有,是否有另一种方法可以启用外键支持,而无需在每个连接上执行PRAGMA foreign_keys = ON"?我需要这个来确保删除总是级联的.
If not, is there another way I can enable foreign key support without doing "PRAGMA foreign_keys = ON" on each connection? I need this to make sure that deletes always cascade.
推荐答案
System.Data.SQLite ADO.NET provider for SQLite 的未来开发由 这个组.该项目目前处于迁移状态,一些功能现在甚至不可用(在 1.0.66 版本中可用,最后由 Robert Simpson(原始库作者)).
Future development of System.Data.SQLite ADO.NET provider for SQLite is done by this group. The project is currently in migration status and some features are even unavailable now (which were available in 1.0.66 version, which is last maintained by Robert Simpson (original library author)).
根据 trunk 中提供的最新源代码,不支持EnforceFKConstraints".但是有 foreign keys
连接字符串属性,其默认值为 False
,也许它可以完成这项工作?尝试在连接字符串中包含 foreign keys=True
属性.请务必使用来自此处的最新稳定版本.
According to latest source code available in trunk "EnforceFKConstraints" is not supported. However there is foreign keys
connection string property which have default value of False
, maybe it does the job? Try including foreign keys=True
property in your connection string. Be sure to use latest stable build from here.
更新.在深入查看源代码后,我几乎可以确定此连接字符串属性完全符合您的要求.
Update. After looking deeper in source, I'm almost sure that this connection string property is doing exactly that you want.
这篇关于SQLite3 中的外键支持的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:SQLite3 中的外键支持
- 在哪里可以找到使用中的C#/XML文档注释的好例子? 2022-01-01
- WebMatrix WebSecurity PasswordSalt 2022-01-01
- C# 中多线程网络服务器的模式 2022-01-01
- 带有服务/守护程序应用程序的 Microsoft Graph CSharp SDK 和 OneDrive for Business - 配额方面返回 null 2022-01-01
- 输入按键事件处理程序 2022-01-01
- C#MongoDB使用Builders查找派生对象 2022-09-04
- 良好实践:如何重用 .csproj 和 .sln 文件来为 CI 创建 2022-01-01
- 如何用自己压缩一个 IEnumerable 2022-01-01
- MoreLinq maxBy vs LINQ max + where 2022-01-01
- Web Api 中的 Swagger .netcore 3.1,使用 swagger UI 设置日期时间格式 2022-01-01