I have a Method that accepts an Expression as Parameter. However the Parser does not recognize q and instead tries to find Foo on it.
The Exception is
System.Linq.Dynamic.Core.Exceptions.ParseException: No property or field 'Foo' exists in type 'QueryStart'
Here is a Test to verify the Problem
[TestClass]
public class QueryParserTests
{
[TestMethod]
public void Parse_can_Select()
{
// Arrange
var query = "Start.Select(q => q.Foo).ToListAsync()";
// Act
var exp = DynamicExpressionParser.ParseLambda<QueryStart, Task>(ParsingConfig.Default, false, query);
// Assert no error was thrown
Assert.IsNotNull(exp);
}
private class QueryTest
{
public int Foo { get; set; }
}
private class QueryStart
{
public IMyQuery<QueryTest> Start { get; set; }
}
private interface IMyQuery<T>
{
IMyQuery<Tnew> MySelect<Tnew>(Expression<Func<T, Tnew>> exp);
Task<List<T>> ToListAsync();
}
}
I have a Method that accepts an Expression as Parameter. However the Parser does not recognize
qand instead tries to findFooonit.The Exception is
Here is a Test to verify the Problem