Can't get Sum() working in Northwind example
- by Vince
Hi,
The following code is generating a runtime error and I have no idea why.
from o in Orders
group o by o.Employee into employeeOrders
select new {
    employeeOrders.Key.EmployeeID,
    employeeOrders.Key.FirstName,
    Orders = 
        from eord in employeeOrders
        orderby eord.OrderID
        select new {
            eord.OrderID,
            eord.OrderDate,
            OrderTotal=eord.OrderDetails.Sum (od => od.UnitPrice)
        }
}
The error is 
Member access 'System.Decimal UnitPrice' of 'LINQPad.User.OrderDetails' not legal on type 'LINQPad.User.Orders
I've also tried this in VS2010 with a standard drag and drop data context and same thing.
Thanks in advance