我用Xamarin。IOS和我想运行简单的关系查询使用LINQ。我得去吃饭了。一个表是NewSource,另一个是NewCategory。两个与Name相关的表。例如:
NewSource表行:
Name: Radikal
Active: true
NewCategory表行:
NewSourceName: Radikal
Active:true
SportUrl: http://www.something.com
EconomyUrl= http://www.something.com
..
..
我写了这个查询从Parse文档:
var query= from post in ParseObject.GetQuery("NewSource")
where (bool)post["Active"]==true //which mean i want to take only active New Source
select post;
var query2 = from comment in ParseObject.GetQuery("NewCategory")
join post in query on comment["NewSourcename"] equals post
select comment;
var comments = await query.FindAsync();
代码不工作。它总是返回null。我哪里做错了?我想关系两个表连接是NewSource。名称和新类别。NewSourceName
我该怎么做?
谢谢。
假设NewSource
表的Name
列链接到NewCategory
表的NewSourceName
列,您可以尝试这样连接它们:
var query2 = from comment in ParseObject.GetQuery("NewCategory")
join post in query on (string)comment["NewSourcename"] equals (string)post["Name"]
select comment;