Q:

How to tell LinqToSQL to use outer join when multiple keys?

I have three tables: tblApplications, tblInterviews and tblDocuments (simplified).
create table tblApplications(
    aplID int not null, --primary key
    aplName varchar(max) not null
)
create table tblInterviews(
    intApl int not null, --primary key & foreign key (tblApplications)
    intID int not null, --primary key
    intDate date not null
)
create table tblDocuments(
    docID int not null, --primary key
    docApl int not null, --foreign key (tblApplications & tblInterviews)
    docInt int null, --foreign key (tblInterviews)
    docPath varchar(max) not null
)

As you can see, application is the 'top' entry, each interview has to reference an application.
And each document has to reference an application and may or may not reference an interview.
If I load this schema into the LinqToSQL designer and try to select the document, it only selects the ones that reference an interview as it uses an inner join to bind the interviews to it.
However it should use an outer join as (part of) the key (docInt) is nullable.
How can I tell LinqToSQL to do so?

A:

Use DefaultIfEmpty in your select clause
DefaultIfEmpty() method  forces the inclusion of null child references where parents have no children. Note that this method of performing an outer join produces a flattened result.
Here you have a vb.net syntax example:
Dim JoinedResult = _
    From t1 In Table1 _
    Group Join t2 In Table2 _
       On t1.key Equals t2.key _
       Into RightTableResults = Group _
    From t2 In RightTableResults.DefaultIfEmpty _
    Select t1.Prop1, _
       t2.Prop2   

Check this link:
Outer Join Sample

