Outer Join is not working in Linq Query: The method 'Join' cannot follow the method 'SelectMany' or is not supported

Posted by Scorpion on Stack Overflow See other posts from Stack Overflow or by Scorpion
Published on 2013-10-23T15:50:34Z Indexed on 2013/10/23 15:53 UTC
Read the original article Hit count: 721

I am writing the Linq query as below: But on run its throwing the following error:

The method 'Join' cannot follow the method 'SelectMany' or is not supported. Try writing the query in terms of supported methods or call the 'AsEnumerable' or 'ToList' method before calling unsupported methods.

LINQ

from a in AccountSet
join sm in new_schoolMemberSet on a.AccountId equals sm.new_OrganisationId.Id 
        into ps from suboc in ps.DefaultIfEmpty()
join sr in new_schoolRoleSet on suboc.new_SchoolRoleId.Id equals sr.new_schoolRoleId
where sr.new_name == "Manager"
where a.new_OrganisationType.Value == 430870007
select new { a.AccountId, a.new_OrganisationType.Value }

I am expecting the result as below:

enter image description here

I never used the Outer join in Linq before. So please correct me if I am doing it wrong.

Thanks

© Stack Overflow or respective owner

Related posts about LINQ

Related posts about linq-to-entities