I am trying to create a dynamic query tool using System.Linq.Expressions.Expression (WPF / C # 4.0) It works with OData Service.
While everything works, while I limit the conditions for creating options such as Equal (..), GreaterThan (..), etc. There seems to be no assembly in condition / As condition, so I tried to build my own. There are already several articles. One of my attempts - How to create a System.Linq.Expressions.Expression file for Like? .
Now, if I use the above solution, we get the expression where
whereCallExpression = {Convert([10000]).Expand("A,B").Where(clt => MyLike(clt.LastName, "te"))}'
which is good, but incorrect, as it does not translate into a valid Odata request.
If I use the Equals condition, the result
whereCallExpression = {Convert([10000]).Expand("A,B").Where(clt => (clt.LastName == "te"))}
which leads to an OData query p>
results = {http://.../Clients()?$filter=LastName eq 'te'&$expand=A,B}
and works as expected.
Am I doing something wrong with implementing the solution or can't use it with OData?
It should go to something like ...?$filter=substringof('te', LastName ) eq true
Any decision on how to fix this?
Hello
Andreas
PS, I implemented a solution extension in a static class, all I changed was the name of the method being called from “Like” to “MyLike”. In addition, since the code used to build the expressions works with any of the build conditions, I assume that now this part is in order. I can send parts of it if necessary