I know a little effort to build dynamic Linq queries like this and this .
No, it seems ideal, since I would like to avoid placing expressions in a string and omit somewhere if it is not needed.
My main problem is that the query is optimized for the database and dynamically omits unnecessary sentences whenever possible.
Are there any new developments in EF 4.0 for such scenarios?
UPDATE
here is one link that I found very useful:
http://www.albahari.com/nutshell/predicatebuilder.aspx
Indeed, adding "And" speakers is dynamically trivial, and adding "Or" filters can easily be done using the predicate builder:
var predicate = PredicateBuilder.False<Product>();
predicate = predicate.Or (p => p.Description.Contains (temp));
and according to LinqPad sql receives radiation according to which filters were applied.
source
share