Sorry, I couldn’t think of a better title! 🙂
I have a table called Process, and it has a recursive relationship to define Process-*Subprocess
Now, each Process can have one or more metrics attached to it: Process-*Metric
So my Process table would look like:
PROCESS
-------
ID
PID (fkey on Process.ID)
And my metric table would look like:
METRIC
------
ID
PID (fkey on Process.ID)
Using LINQ with EF, can I build a query that will return the sum of:
- the count of Metrics associated with a Process
- the count of Metrics associated with all Subprocesses that are descendents of that Process
I’m looking for a way to return this info with a single call to the db if possible.
Thanks!
Chris
Basically you have two options.