linq关系查询



我用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;

相关内容

  • 没有找到相关文章

最新更新