我正在尝试按客户 ID 对订单进行分组,然后将返回的订单(按客户)投影到列表中。试图弄清楚我将如何做到这一点?
List<OrderGroup> set = OrderRepository.GetAllOrders
.GroupBy(x => x.CustomerId).Select(result => new OrderGroup
{
Orders = ???? //should be all orders from one customer.
}).ToList();