Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/sqlite/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
windowsrt上的关系型SQLite_Sqlite_Windows Runtime_Foreign Keys_Windows Store Apps - Fatal编程技术网

windowsrt上的关系型SQLite

windowsrt上的关系型SQLite,sqlite,windows-runtime,foreign-keys,windows-store-apps,Sqlite,Windows Runtime,Foreign Keys,Windows Store Apps,我正在使用,但我看不到任何定义表之间关系的方法。SQLite for WinRT是否支持此功能 如果没有,是否有针对Windows RT的关系本地数据库的替代解决方案?数据库引擎本身支持关系。一种方法是在创建表时指定外键: CREATE TABLE Foo( Id integer primary key autoincrement not null , ... ) CREATE TABLE Bar( Id integer primary key autoincrement not null,

我正在使用,但我看不到任何定义表之间关系的方法。SQLite for WinRT是否支持此功能


如果没有,是否有针对Windows RT的关系本地数据库的替代解决方案?

数据库引擎本身支持关系。一种方法是在创建表时指定外键:

CREATE TABLE Foo(
Id integer primary key autoincrement not null ,
...
)

CREATE TABLE Bar(
Id integer primary key autoincrement not null,
FooId integer not null REFERENCES Foo (Id) ON UPDATE CASCADE,
...
)
我认为每个db连接还必须通过执行以下pragma来启用外键:

PRAGMA foreign_keys = ON
就可用的ORM而言,我想这要视情况而定。我只使用过,所以我只能说。据我所知,外键目前不是SQL Net支持的功能。您必须手动管理这些关系

例如,假设您的
Foo
对象中有一个对
Bar
对象的引用

对于创建表,不能使用SQLite Net表创建方法。您必须使用SQL来创建表以及关系


此外,当您使用SQL Net加载
Foo
对象时,相关的
对象将不会自动加载。您将需要进行第二次SQL Net调用来加载
Bar
对象。

这很不幸,但是thanx:)顺便说一句,我检查了他们的GIT项目宿主,根据最近的一些提交(此时已经3个月了),有一些努力来实现这一点。