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 MyExpressions {
public static Expression<Func<Product,bool>> IsAGoodProduct() {
return (p) => p.Quality>3;
}
}
And would like to use that in LINQ statements, so
var goodProds = from p in dataContext.Products
where ????? // how do I use IsAGoodProduct here?
select p;
Sure, I could use the IQueryableExtension.Where function, but that would make joins and other functions alot uglier for more complex queries.
Is this possible or is it a limitation of LINQ?