I have a projected that I want to keep in LINQ vs T-Sql. To do this in memory it loads about 71,000 objects and then LINQ groups with various aggregates.
In regards to that, what is the support for the LINQ 'group by'?
var summaries = (from cl in indexedClaimsSet.AsParallel()
let oGcCount = clist.Where(c => c.ID== gr.Key.ID).Count()
let gcCount = gr.Count()
Id = gr.Key.ID,
DisplayId = gr.Key.DisplayID,
FullName = gr.Key.Name,
City = gr.Key.City,
State = gr.Key.State,
oAmountPaid = clist.Where(c => c.ID == gr.Key.ID).Sum(c => c.TotalPaid),
Count = oGcCount,
pCount = gcCount,
PatientCount = clist.Where(a => a.ID == gr.Key.ID).Select(p => p.patId).Distinct().Count()
}).Where(cl => cl.Count > 0).OrderBy(cl => cl.Id);
Dec 29, 2010 at 1:45 AM
Edited Dec 29, 2010 at 1:45 AM
With regards to your group by question, no it's not currently supported...
I have a couple thoughts that might help you.
1. Move the "let gcCount..." above the "let oGcCount..." and then move the .Where(cl=>cl.count > 0) also above the "let
oGcCount..." This will avoid a number of operations where they are not necessary? (Maybe I'm wrong)...
2. Is you "clist" an indexed collection? With all of the "clist.Where(...some id lookup)" it would help the perf if the clist was indexed.
Hope this helps a little.