OrmLite 可以为主键以外的属性指定外键吗

Can OrmLite specify foreign key to an attribute other than the primary key

我有一个 table 结构,其中来自员工 table 的外键引用部门 table 的主键以外的内容。这是出于历史原因,所以就是这样。

有效:q.Join<Department>((e, d) => e.DepartmentId == d.DepNo);。注意部门的主键Id.

现在,有什么方法可以指定连接关系(使用列名)?原因是我想使用 AutoQuery 的内置 IJoin<Employee,Department> 东西,但它不允许我指定要使用的列。

请参阅 Reference Conventions 上的文档,了解如何定义隐式 PK 和 FK 引用。

AutoQuery 仅支持隐式引用,如果您需要更多自定义行为,则需要创建自定义 AutoQuery 实现。