-
Type: Improvement
-
Resolution: Fixed
-
Priority: Unknown
-
None
-
Affects Version/s: None
-
Component/s: None
Problem
When working with an IQueryable dataset I get a Realms.RealmResults<MyType> object. I have two different objects that request data in different ways and I want to see if they contain the same dataset.
My first attempt would be:
MyRealmObject.OneToMany.SequenceEqual(MyOtherRealmObject.OneToMany);
The Realm throws an error
> System.NotSupportedException
HResult=0x80131515
Message=The method 'SequenceEqual' is not supported
Source=Realm
Solution
If I manually enumerate the IQueryable to a list then it works:
MyRealmObject.OneToMany.ToList().SequenceEqual(MyOtherRealmObject.OneToMany.ToList());
So it seems that for Realm to support SequenceEqual we need to expose the underlying set of objects so they can be compared to each other.
Queryable objects do normally have this interface:
https://learn.microsoft.com/en-us/dotnet/api/system.linq.queryable.sequenceequal?view=net-6.0
Alternatives
I am currently using the aforementioned .ToList() workaround.
How important is this improvement for you?
I would like to have it but have a workaround
Feature would mainly be used with
Local Database only