System.Linq.Dynamic.Core: Cannot use with EF.Functions.ILike(anything, "%aaa%")
I get error:
No property or field 'EF' exists in type 'xxxxx'
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Comments: 15 (4 by maintainers)
I get error:
No property or field 'EF' exists in type 'xxxxx'
Hello @mhosman ,
Here is an online example with
WhereDynamic
using a simple where clause and one usingEF.Functions.Like
Example: https://dotnetfiddle.net/xCaJr8
In your case, you missing the
x
inx.status
,It should have been
.WhereDynamic(x => "x.status == true")
.It looks like we could improve this part to allow property without having to specify the
x
but for now, you must use a valid C# syntax.@mhosman ,
Everything you can do in C#, you should be able to do it on @mhosman .
Be careful, C# Eval Library require a valid C# syntax. The
or
should be replaced by||
.So probably more something like this:
Hello all,
Unfortunately, this request go beyond of what this library can offer.
There is currently no plan adding it on a short time.
However, that is possible with another of our library: https://eval-expression.net/
The library is paid but Dynamic LINQ extension such as
WhereDynamic
as free.You can find some documentation here: https://eval-expression.net/linq-dynamic
Let me know if that solves your issues.
Best Regards,
Jon
To get real SQL Like you need to use the EntityFramework.DynamicLinq or Microsoft.EntityFrameworkCore.DynamicLinq NuGet.
See this for an example: https://github.com/zzzprojects/System.Linq.Dynamic.Core/blob/master/src-console/ConsoleAppEF2.1.1_InMemory/Program.cs#L212
You could use
Contains
? See https://github.com/zzzprojects/System.Linq.Dynamic.Core/blob/5863256c11e32b100c917d133c54bda4afae4d8a/test/System.Linq.Dynamic.Core.Tests/QueryableTests.Contains.cs#L12