class TableObj1 {
public string Id {get; set;}
public string Name {get; set;}
}
class TableObj2 {
public string Id {get; set;}
public string Email {get; set;}
}
class MergeObj {
public TableObj1 Obj1 {get; set;}
public TableObj2 Obj2 {get; set;}
}
我的问题是如何在加入两个表时返回 MergeObj 列表。我试过:
public IEnumerable<MergeObj> QueryJoin() {
return (
from obj1 in conn.Table<TableObj1>()
join obj2 in conn.Table<TableObj2>()
on obj1.Id
equals obj2.Id
select new MergeObj{Obj1 = obj1, Obj2 = obj2}
);
}
void main() {
IEnumerable<MergeObj> mergeObjs = QueryJoin();
}
但是 QueryJoin() 给出了异常:System.NotSupportedException,不支持连接。
请注意我使用的是 sqlite.net 而不是 ADO.net。