Linq to Entities - left Outer Join

Posted by user255234 on Stack Overflow See other posts from Stack Overflow or by user255234
Published on 2010-03-22T14:25:33Z Indexed on 2010/03/22 14:41 UTC
Read the original article Hit count: 303

Filed under:

Could you please help me to figure this one out? I need to replace a join with OSLP table with OUTER join. Seems a bit tricky for someone who is not an expert in Linq to entities. How would I do that?

var surgeonList = (
    from item in context.T1_STM_Surgeon
        .Include("T1_STM_SurgeonTitle")
        .Include("OTER")
    where item.ID == surgeonId
    join reptable in context.OSLP 
        on item.Rep equals reptable.SlpCode
    select new
    {
        ID = item.ID,
        First = item.First,
        Last = item.Last,
        Rep = reptable.SlpName,
        Reg = item.OTER.descript,
        PrimClinic = item.T1_STM_ClinicalCenter.Name,
        Titles = item.T1_STM_SurgeonTitle,
        Phone = item.Phone,
        Email = item.Email,
        Address1 = item.Address1,
        Address2 = item.Address2,
        City = item.City,
        State = item.State,
        Zip = item.Zip,
        Comments = item.Comments,
        Active = item.Active,
        DateEntered = item.DateEntered
    }).ToList();

Thanks in advance!!

© Stack Overflow or respective owner

Related posts about linq-to-entities