定義
// Define your models like regular C# classes public class Dog : RealmObject { [ObjectId] public string SSN { get; set; } public string Name { get; set; } public int Age { get; set; } public Person Owner { get; set; } } public class Person : RealmObject { public string Name { get; set; } public RealmList<Dog> Dogs { get; } }
このメソッド
public Dog FindById (int id) { return realm.All<Dog>().Where (d => d.SSN == id.ToString()).First (); }
すると
System.NotSupportedException: The rhs of the binary operator 'Equal' should be a constant or closure variable expression at Realms.RealmResultsVisitor.VisitBinary
return realm.All<Dog>().Where(d => d.SSN == id.ToString()).FirstOrDefault();
FirstOrDefault
だった。おそらくnullの対処ができないからだと思われる。