I'd like to merge the following Expressions:
// example class
class Order
{
List<OrderLine> Lines
}
class OrderLine { }
Expression<Func<Order, List<OrderLine>>> selectOrderLines = o => o.Lines;
Expression<Func<List<OrderLine>, Boolean>> validateOrderLines = lines => lines.Count > 0;
// now combine those to
Expression<Func<Order, Boolean>> validateOrder;
I got it to work using a invoke on the selectOrderLines and supplying the result to the validateOrderLines, but because I'm using these expressions in Entity Framework, I have to actually create a clean expression which should represent:
Expression<Func<Order, Boolean>> validateOrder = o => o.Lines.Count > 0;
How can I do this?