title: Entity Framework Core nullable foreign key
body: <p>I am having trouble getting a list of entities where a foreign key value could be null.</p>
  
  <p><strong>The Models:</strong></p>
  
  <pre><code>public class Company
  {
      [Key]
      [Required]
      public int Id { get; set; }
      [Display(Name = "Company Name")]
      public string CompanyName { get; set; }
      [Display(Name = "Main Phone")]
      public string LandPhone { get; set; }
      [Display(Name = "Fax")]
      public string FaxPhone { get; set; }
  }
  
  public class Contact
  {
      [Key]
      [Required]
      public int Id { get; set; }
      [Display(Name ="First Name")]
      public string FirstName { get; set; }
      [Display(Name = "Last Name")]
      public string LastName { get; set; }
      [EmailAddress]
      public string Email { get; set; }
      [Display(Name = "Mobile Phone")]
      public string MobilePhone { get; set; }
      [Display(Name = "Office Phone")]
      public string LandPhone { get; set; }
      [Display(Name = "Fax")]
      public string FaxPhone { get; set; }
      public string Title { get; set; }
      public int CompanyId { get; set; }
      [ForeignKey("CompanyId")]
      public Company Company { get; set; }
  }
  </code></pre>
  
  <p>When I try and get the list of all <code>Contacts</code> and one of them has a null value for <code>CompanyId</code> in my database, it will skip that <code>Contact</code> in the list it returns.  For example, the query <code>var contacts = _context.Contacts.Include(c =&gt; c.Company).ToList();</code> only returns Josh Stone from the following table:</p>
  
  <p><a href="https://i.stack.imgur.com/83zOT.png" rel="noreferrer">Contacts Table</a></p>
  
  <p>I am using Entity Framework Core 1.0.0.  Any help would be sincerely appreciated.</p>