c# - Name doesn't exist in the current context LEFT OUTER JOIN in LINQ -


i doing left outer join on multiple tables. getting following error "the name 'ep' not exist in current context"

getting error on 2 nd join onwards. doing wrong.

from c in corporates  join ep in employeepositions on c.id equals ep.corporateid eps  epsj in eps.defaultifempty()  join e in employees on ep.employeeid equals e.id es  esj in es.defaultifempty()  join ee in employeeevaluations on e.id equals ee.employeeid eels  eelsj in eels.defaultifempty()  join ees in employeeevaluationstatuses on ee.evaluationstatusid equals ees.id eevls  eevlsj in eevls.defaultifempty()  join v in vouchers on e.id equals v.employeeid vs  vsj in vs.defaultifempty()  select new { ep = ep, empevals = ee, empevalstatus = ees } 

if have outer join (a groupjoin, actually), range variable changes. let me explain. in example, first part ...

from c in corporates join ep in employeepositions on c.id equals ep.corporateid 

... inner join. range variable ep here. that's variable can use later on in query.

now turn outer join:

from c in corporates join ep in employeepositions on c.id equals ep.corporateid eps epsj in eps.defaultifempty() 

the range variable epsj. should use epsj in rest of linq statement.

if want, can reuse range variable name:

from c in corporates join ep in employeepositions on c.id equals ep.corporateid eps ep in eps.defaultifempty() 

Popular posts from this blog

php - How should I create my API for mobile applications (Needs Authentication) -

5 Reasons to Blog Anonymously (and 5 Reasons Not To)

Google AdWords and AdSense - A Dynamic Small Business Marketing Duo