I've never managed to do this without creating two queries or just using fetch.
If you take the following which runs ok.
from a in AccountSet
join c in ContactSet
on a.PrimaryContactId.Id equals c.ContactId
into gr
from c_joined in gr.DefaultIfEmpty()
select new
{
contact_name = c_joined.FullName,
account_name = a.Name
}
Then try adding a join before the account join:
from u in SystemUserSet
join a in AccountSet
on u.SystemUserId equals a.OwnerId.Id
join c in ContactSet
on a.PrimaryContactId.Id equals c.ContactId
into gr
from c_joined in gr.DefaultIfEmpty()
select new
{
contact_name = c_joined.FullName,
account_name = a.Name
}
You get 'The method 'GroupJoin' cannot follow the method 'Join' or is not supported.'
Sometimes it's easier just to go straight to fetch in these complex scenarios since it is the only query mechanism that supports all scenarios, QueryExpression and LINQ are both restrictive in comparison.
hth,
Scott
Scott Durow
Blog www.develop1.net
Follow Me
Rockstar365
If this post answers your question, please click "Mark As Answer" on the post and "Mark as Helpful"