将PackageItems列表添加到已经有效的此代码中,并抛出ObjectContext错误:
var ret = packages.Select(s => new Package
{
PackageNumber = s.PackageNumber,
PackageTotalValue = s.PackageTotalValue,
PackageDate = s.PackageDate,
PackageItems = s.Order.PackageItems.Select(i => new PackageItem
{
ItemID = i.ItemID,
ItemDescription = i.ItemDescription,
Quantity = i.Quantity,
Cost = i.Cost
}).ToList()
}).ToArray();