You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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:
Technically you can try to use NReco.LambdaParser in this way: parse user-entered expression with Parse method, get Expression and then traverse it and build another Expression that is compatible with EF Where.
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).
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: