Left outer Join with LINQ
c#, linq
Solution
Try,
from c in DataContext.cus_contact
join cp in DataContext.cus_phone_jct on c.id equals cp.contact_id into cp2
from cp3 in cp2.DefaultIfEmpty()
join p in DataContext.cus_phone on cp3.phone_id equals p.id into p2
from p3 in p2.DefaultIfEmpty()
where c.cus_id = 4
select
c.id,
cp3.id
...
Problem
Can someone help me translate this query to LINQ? I cant find a good way to translate it, Thanks! ``` SELECT C.id, C.id_old, C.cus_id, C.namefirst, C.title, CP.id as 'cus_phone_jct.id', CP.contact_id, CP.phone_id, CP.ext, P.id as 'cus_phone.id', P.phone, P.typ_id, P.status_id, P.donotcontact FROM cus_contact C LEFT OUTER JOIN cus_phone_jct CP ON C.id = CP.contact_id LEFT OUTER JOIN cus_phone P ON CP.phone_id = P.id WHERE C.cus_id = 4 ```