Modified プロパティが設定されていないすべての要素を取得したいのですが、Realm で動作させることができないようです。
サンプルコード:
public class FooModel : RealmObject
{
public DateTimeOffset? Modified { get; set; }
}
...
public List<FooModel> GetAllUnmodified()
{
var realm = Realm.GetInstance();
//doesn't work
var result1 = realm.All<FooModel>().Where(model => model.Modified == null).ToList();
//doesn't work
var result2 = realm.All<FooModel>().Where(model => !model.Modified.HasValue).ToList();
//doesn't work
DateTimeOffset? testValue = null;
var result3 = realm.All<FooModel>().Where(model => model.Modified == testValue).ToList();
//doesn't work
var result4 = realm.All<FooModel>().Where(model => model.Modified == default(DateTimeOffset?)).ToList();
return result1;
}
常に取得System.NotSupportedException: The rhs of the binary operator 'Equal' should be a constant or closure variable expression.
またはSystem.NotSupportedException: The member 'HasValue' is not supported
何か見逃しましたか?Realm の Linq が実際にサポートしているものを確認する良い方法はありますか?
Android での Realm Xamarin v0.77.1 の使用
編集:
コメンターが提案したように、linq式ツリーを作成してみました。これにより、System.MissingMethodException: Method 'RealmResults'1.get_Provider' not found.
例外が発生しました。