Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Contains search in an Enum #414

Closed
ste1nstone opened this issue Aug 21, 2020 · 2 comments
Closed

Contains search in an Enum #414

ste1nstone opened this issue Aug 21, 2020 · 2 comments
Assignees

Comments

@ste1nstone
Copy link

Hi

I try to do an dynamic request which returns me all entries where an enum column contains a special value.
Unfortunately I could not find a solution the archieve this with a dynamic expression.

It seems like EF core has also a problem with this why I used the workaround from the following issue dotnet/efcore#20604
But with this I was able to do the request
.Where(s => ((string)(object)s.Product).ToLower().Contains("test"))

If I now try the same request as dynamic string
.Where("((string)(object)Product).ToLower().Contains(\"test\"))")
I receive the following issue '.' or '(' or string literal expected (at index 8)

Has someone an idea how I can fix this problem?

Thanks and best regards
Philipp

@JonathanMagnan JonathanMagnan self-assigned this Aug 21, 2020
@JonathanMagnan
Copy link
Member

Hello @ste1nstone ,

Thank you for reporting, we will look at it.

Best Regards,

Jon


Performance Libraries
context.BulkInsert(list, options => options.BatchSize = 1000);
Entity Framework ExtensionsEntity Framework ClassicBulk OperationsDapper Plus

Runtime Evaluation
Eval.Execute("x + y", new {x = 1, y = 2}); // return 3
C# Eval FunctionSQL Eval Function

@JonathanMagnan
Copy link
Member

Hello @ste1nstone ,

Unfortunately, we didn't find a working solution with Dynamic LINQ.

However, it is already possible to do such dynamic query with our other library: C# Eval Expression (LINQ extension method part are free)

Here is an online example: https://dotnetfiddle.net/qcbJ5I

Best Regards,

Jon

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants