You can't use the syntax h => h.PaymentType.Id || h.Bank.Id
, because int || int
isn't defined. You could use params
to easily pass in multiple expressions. Note that params
has to be the last in the parameter list, so I swapped the order.
public static IQueryable<T> WhereIn<T, TValue>(this IQueryable<T> query,
IEnumerable<TValue> values,
params Expression<Func<T, TValue>>[] valueSelectors)
You'd use it like:
iq = iq.WhereIn(paymentTypeIds, h => h.PaymentType.Id, h => h.Bank.Id);