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 中的外键支持
基础教程推荐
- MS Visual Studio .NET 的替代品 2022-01-01
- 将 XML 转换为通用列表 2022-01-01
- 为什么Flurl.Http DownloadFileAsync/Http客户端GetAsync需要 2022-09-30
- 有没有办法忽略 2GB 文件上传的 maxRequestLength 限制? 2022-01-01
- 将 Office 安装到 Windows 容器 (servercore:ltsc2019) 失败,错误代码为 17002 2022-01-01
- SSE 浮点算术是否可重现? 2022-01-01
- rabbitmq 的 REST API 2022-01-01
- 如何在 IDE 中获取 Xamarin Studio C# 输出? 2022-01-01
- c# Math.Sqrt 实现 2022-01-01
- 如何激活MC67中的红灯 2022-01-01