I would like to implement method with input like this:
public async Task<IList<T>> Get(Expression<Func<Class1, Class2, Class3, bool>> predicate)
{
var query = from c1 in db.Class1
from c2 in db.Class2
from c3 in db.Class3
select new { c1, c2, c3 };
return query.Where(predicate).ToListAsync();
}
I want call this method like Get((x, y, z) => x.Prop1 == 1 && y.Prop5 == 4)
I've got error:
Error CS1503 Argument 2: cannot convert from 'System.Linq.Expressions.Expression<System.Func<Class1, Class2, Class3, bool>>' to
'System.Linq.Expressions.Expression<System.Func<<anonymous type: Class1 pcp, Class2 pc, Class3 bu>, bool>>'
in line containing Where(predicate)
How to I solve this issue ?