I like to reuse expressions for DRY reasons, but how do I reuse the expressions within a LINQ statement?
e.g.
I have
public static class MyE
If you move from the LINQ syntactic sugar it is possible:
var goodProds = dataContext.Products.Where(MyExpressions.IsAGoodProduct());
Without it, it isn't possible.
There's nothing to stop you mixing the two styles to build a single query though.
Example:
var goodProds = from p in dataContext.Products
.Where(MyExpressions.IsAGoodProduct())
group p by p.Category into g
select new {Category = g.Key, ProductCount = g.Group.Count()};