I have a model which represents email with email attachments and email headers. The email attachments and the email headers both have EmailId as foreign key and both foreign keys cannot be null. I try to load the Emails model using entity framework and I try to load the attachments and the headers using include.
context.Emails.Include(x => x.EmailAttachments).Include(x => x.EmailHeaders)
Generates left outer join for email attachments and inner join for email headers.
context.Emails.Include(x => x.EmailHeaders).Include(x => x.EmailAttachments)
Whereas the above code generates left outer join for email headers and inner join for email attachments.
Is there a way to make both the includes to generate left outer join?
EDIT: Adding Model Structure
public class Email
{
public long Id { get; set; }
public string From { get; set; }
public string To { get; set; }
public string Subject { get; set; }
}
public class EmailAttachment
{
public long Id { get; set; }
public long EmailId { get; set; }
public string FileName { get; set; }
}
public partial class EmailHeader
{
public long Id { get; set; }
public long EmailId { get; set; }
public string Text { get; set; }
public string Value { get; set; }
}