I have a simple class with one int property called Int:
public class TestObject
{
public int Int { get; set; }
}
and wherePredicate "Int >= 90"
When I trying to use it with a IQueryable.Where(wherePredicate) the error occurs: System.Linq.Dynamic.Core.Exceptions.ParseException: '.' or '(' or string literal expected
When I change wherePredicate to "It.Int >= 90" - works as expected.
Int
is a reserved key-word.
Use a different Property name:
void Main()
{
var l = new List<TestObject>();
var q = l.AsQueryable();
var result = q.Where("X >= 90");
result.Dump(); // LINQPad
}
public class TestObject
{
public int X { get; set; }
}