Hi have just started using Realm dotnet
When I perform a simple query like
var results = realm.All<MyRealmType>().Where(x => x.Property == otherVariable.Property);
So in the Where clause I am comparing two strings to retrieve the data I need from the realm.
I get the following error
{System.NotSupportedException: The rhs of the binary operator 'Equal' should be a constant or closure variable expression
at Realms.RealmResultsVisitor.VisitBinary (System.Linq.Expressions.BinaryExpression b) [0x000cb] in <filename unknown>:0
at Realms.ExpressionVisitor.Visit (System.Linq.Expressions.Expression exp) [0x000d2] in <filename unknown>:0
at Realms.RealmResultsVisitor.VisitMethodCall (System.Linq.Expressions.MethodCallExpression m) [0x0006a] in <filename unknown>:0
at Realms.ExpressionVisitor.Visit (System.Linq.Expressions.Expression exp) [0x000ec] in <filename unknown>:0
at Realms.RealmResults`1[T].CreateResultsHandle () [0x00037] in <filename unknown>:0
at Realms.RealmResults`1[T].get_ResultsHandle () [0x0000d] in <filename unknown>:0
at Realms.RealmResults`1[T].GetEnumerator () [0x00000] in <filename unknown>:0
at System.Collections.Generic.List`1[T]..ctor (IEnumerable`1 collection) <0x1001aa7e0 + 0x001df> in <filename unknown>:0
at System.Linq.Enumerable.ToList[TSource] (IEnumerable`1 source) <0x100659e70 + 0x0004b> in <filename unknown>:0
at MyNamespace.MyMethod (System.Collections.Generic.List`1 myListList) [0x000b0] in C:PathToMyFileMyFile.cs:140 } System.NotSupportedException
I'm not sure what this means. Does it mean that my Where clause can only use a hardcoded string or int like the example below?
var results = realm.All<MyRealmType>().Where(x => x.Property == "stringToCompare");
If so this seems very limiting. Does anyone know how to resolve this.
Thanks in advance.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…