I have been searching about how to make dynamic queries and everything that I found was using "Method Syntax".
Is it possible create dynamic predicates for "Query syntax" ?
I tried to use something like
Expression<Func<TEntity, bool>>
inside the predicate but the compiler return the following message
"Cannot convert Expression<Func<TEntity, bool>> to bool"
it works on 'Method Syntax' but not on 'Query Syntax'
It works:
Expression<Func<Localization, bool>> locClause = (l => l.id == locId);
var results = UnitOfWork.Localization.AsQueryable().Where(locClause).ToList();
It doesn't work:
Expression<Func<Localization, bool>> locClause = (l => l.id == locId);
var result = from l in UnitOfWork.Localization.AsQueryable()
where locClause
select l;
Is there a way to do this ?