在Xamarin.Android上从Parse.com检索查询有很多关系

时间:2015-09-21 19:10:38

标签: c# parse-platform xamarin relation

我试图找出如何做到这一点。在documentation上,它有一个关于如何使用一种关系获取查询的示例:

// suppose we have a book object
var book = ...

// create a relation based on the authors key
var relation = book.GetRelation<ParseObject>("authors");

// generate a query based on that relation
var query = relation.Query;

// now execute the query
query.FindAsync ();

但如果我有3个像我这样的关系? enter image description here

reviewObject =  new ParseObject("Review");
var relationBusiness = reviewObject.GetRelation<ParseObject>("business");
relationBusiness.Add(application.currentBusiness);
var relationUser = reviewObject.GetRelation<ParseObject>("user");
relationUser.Add(ParseUser.CurrentUser);
var relationStaff = reviewObject.GetRelation<ParseObject> ("staff");
relationStaff.Add (application.currentStaff);

请帮忙。谢谢

1 个答案:

答案 0 :(得分:0)

毕竟不是那么难:

var query = ParseObject.GetQuery ("Review")
    .WhereEqualTo ("business", relationBusiness)
    .WhereEqualTo ("user", relationUser)
    .WhereEqualTo ("staff", relationStaff);

IEnumerable<ParseObject> reviews = await query.FindAsync();

(relationBusiness,relationUser和relationStaff是ParseObject而不是关系)