-
Notifications
You must be signed in to change notification settings - Fork 53
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
Is it possible to build lambda for entity framework queries #18
Comments
Technically you can try to use NReco.LambdaParser in this way: parse user-entered expression with However I don't think that this is very good idea: LambdaParser supports syntax (properties/method calls ) that you'll not be able to convert to SQL. If you need parser for user-defined conditions that can be easily converted to SQL take a look to Relex parser (which is part of NReco.Data library, see also https://github.com/nreco/data/wiki/Relex). |
Thanks for the quick response. I looked at both and decided to go with below approach:
and use it in where clause like this:
|
I have a requirement to convert predicates issued as string to lambda used for EF queries. Is it possible with lambdaparser? Code snippet will be helpful. Thanks
Example:
using (var context = new EntityContext())
{
var customersList = context.Customers
.Where(c => "c.Invoices.Count > 2")
.ToList();
}
The text was updated successfully, but these errors were encountered: