realm-net

How to check for null on Nullable types using Linq expression in Realm?

夙愿已清 提交于 2020-01-04 09:28:09
问题 I want to get all elements where the Modified property isn't set but can't seem to get it to work with Realm. Sample Code: 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(); /

realm.xamarin throws error: The method 'Contains' is not supported. same for 'Any'

房东的猫 提交于 2020-01-02 05:01:09
问题 i am writing a query which required 'WHERE IN' like clause in realm.xamarin linq query. below is the query i tried: var IdsToMatch = observations.Select(x => x.Id) var results = from d in realm.All<Observations>() where IdsToMatch.Any(p => p == d.Id) select d; also tried this with Contains : var results = from d in realm.All<Observations>() where IdsToMatch.Contains(d.Id) select d; but this throws error: The method 'Contains' is not supported The method 'Any' is not supported What is the

realm.xamarin throws error: The method 'Contains' is not supported. same for 'Any'

送分小仙女□ 提交于 2019-12-05 11:05:47
i am writing a query which required 'WHERE IN' like clause in realm.xamarin linq query. below is the query i tried: var IdsToMatch = observations.Select(x => x.Id) var results = from d in realm.All<Observations>() where IdsToMatch.Any(p => p == d.Id) select d; also tried this with Contains : var results = from d in realm.All<Observations>() where IdsToMatch.Contains(d.Id) select d; but this throws error: The method 'Contains' is not supported The method 'Any' is not supported What is the solution for this? EDIT : here is the stack trace for the error: UNHANDLED EXCEPTION: 06-07 15:04:55.097 I