Out of the mouse there. The where parameter is a simple type closure Func<T, bool>(where T is the type of your database items โ I donโt know them from your code), and you can wrap it in a (anonymous) function.
Func<Func<T, bool>, IEnumerable<T>> MakeQuery = (Func<T, bool> whereParam) => db.TableAs.Where(whereParam).Take(10);
Use it like this:
var query1 = MakeQuery(a => a.TableBS.Count() > someValue1);
Dario source
share