How do I query relational data using subclasses? parse.com and Unity

Im trying to query all elements of a subclass in Unity. I found an SDK limitation or missing something. Subclasses can be requested as per the documentation.

> var query = new ParseQuery<Armor>()
    .WhereLessThanOrEqualTo("rupees", ((Player)ParseUser.CurrentUser).Rupees);
query.FindAsync().ContinueWith(t =>
{
    IEnumerable<Armor> result = t.Result;
});

      

Im however using a relationship table and cannot specify Here is my code:

IEnumerator LoadMyDesigns(Action<RequestResult> result) {

    ParseUser user = ParseUser.CurrentUser;
    ParseRelation<Design> relation = user.GetRelation<Design>("designs");
    Task<IEnumerable<Design>> task = relation.Query.FindAsync();


    while (!task.IsCompleted) yield return new WaitForEndOfFrame();

    if (task.IsFaulted) {
        //error
        foreach(var e in task.Exception.InnerExceptions) {
            ParseException parseException = (ParseException) e;
            Debug.LogError("Error message " + parseException.Message);
            Debug.LogError("Error code: " + parseException.Code);
            result(new RequestResult(true, parseException.Message));
        }
    }
    else {
        result(new RequestResult(true, new List<Design>(task.Result)));
    }
}

      

And the error:

ArgumentNullException: The ParseObject class name must be specified when creating the ParseQuery.

So the question is, how do you specify the type of the query subclass when using relations?

Thank.

+3


source to share


2 answers


I was struggling with the same problem and in my case I needed to provide theName property again in the GetRelationProperty call.

For example:



[ParseFieldName("designs")]
public ParseRelation<Design> Designs
{
    get { return GetRelationProperty<Design>("Designs"); }
}

      

+1


source


Try asking for a table of designs.

Make a new request for the class "Projects" where equal("owner", PFUser.currentUser())



This should return all projects for the current user.

0


source







All Articles