I assume that your database query returns a connection between CostPage and Item. If so, first you need to group your lines to get the values ββfor CostPage, after this project for your DTO type. I really doubt that you will see many benefits when parallelizing code.
Your code should look something like this:
costPages = table.AsEnumerable().GroupBy(dr=> new { CostPageNumber = dr[0].ToString(), Description = dr[1].ToString(), OrderType = Convert.ToChar(dr[2].ToString()), VendorName = dr[3].ToString() }) .Select(x => new CostPageDTO(){ CostPageNumber = x.Key.CostPageNumber, Description = x.Key.Description, OrderType = x.Key.OrderType, VendorName = x.Key.VendorName, Items = x.Select(dr=> new ItemDTO{
Petko Petkov Dec 09 '13 at 15:43 2013-12-09 15:43
source share