Search code examples
xamarinrealm

Is it possible to query nested objects in Realm with Xamarin?


When accessing a nested object with the code below the following exception appears:

System.NotSupportedException: The left-hand side of the Equal operator must be a direct access to a persisted property in Realm.

However in Objective C it seems that you can somehow query nested objects. Is it planned or are there are solutions to query nested objects in xamarin?

Realm.All<Person>().Where(p => p.Name.Firstname == "Test");

public class Person : RealmObject
{
    public string Town { get; set; }
    public PersonName Name { get; set; }
}

public class PersonName : RealmObject
{
    public string Firstname { get; set; }
    public string Lastname { get; set; }
}

Solution

  • This is a planned feature. You can keep track of the GitHub issue.