I cannot wrap my head around how i manage to select columns in a queryable by specifying an expression as a parameter.
Method A(IQueryable<Order> query)
Inside Method A i want to specify which columns to select, so i dont get all columns right away, like this:
query.Select(x => new { x.OrderNumber, x.Payment, x.Customer })
This is easy if i specify this directly in Method A, but i want to pass the information using a parameter. I tried using a expression like this:
Expression<Func<Order, dynamic>> columns
But i can't get it to work, since i can only specify one columns, where i call Method A, like this:
MethodA(query, (x) => x.OrderNumber);
How can i specify more than one property?