Change your loModel to join all three tables. Then, you will need one foreach only.


Try something like this:

from client_uo in UserObjects
join client_obj in Objects on client_uo.ObjectID == client_obj.ObjectID
join p in Problems on p.ObjectID == clt_obj.ObjectID
join pu in ProblemUsers on p.ProblemID == pu.ProblemID
join assignee in Users on pu.UserID == assignee.UserID
where client_obj.UserID == ClientUserID

that should produce a multi join that gets you from ClientUserID to Client-UserObjects to ProblemObjects to Problems to ProblemUsers (assignees?) to Users, with all the data available at one go. You may want to group it together, either by object, by problem, or by assigned user, depending on the display you're trying to produce.

Related Articles