title: What is difference between HasRequired and HasOptional
body: <p>I have following entities</p>
  
  <pre><code>public class SchoolContext : DbContext
      {
          public DbSet&lt;Address&gt; Addresses { get; set; }
          public DbSet&lt;Employee&gt; Employees { get; set; }     
      }
  
      public class Address
      {
          public int Id { get; set; }
          public string Street { get; set; }
  
          public virtual Employee Employee { get; set; }
      }
  
      public class Employee
      {
          public int Id { get; set; }
          public string Name { get; set; }
  
          public virtual Address Address { get; set; }
      }
  </code></pre>
  
  <p>If I set relationship between Employee and Address with following Fluent API</p>
  
  <pre><code>protected override void OnModelCreating(DbModelBuilder modelBuilder)
          {
              // Option #1
              modelBuilder.Entity&lt;Employee&gt;()
                          .HasRequired(s =&gt; s.Address)
                          .WithRequiredPrincipal(a =&gt; a.Employee);
  
              // Option #2
              modelBuilder.Entity&lt;Employee&gt;()
                          .HasOptional(s =&gt; s.Address)
                          .WithRequired(a =&gt; a.Employee);
  
          }
  </code></pre>
  
  <p>Above two options create table structure exactly same, if so, what is different between two options. If I go with option #1, I thought Employee entity always should have address entity, but it was not. I was able to save Employee entity without address value. </p>
  
  <p>Thanks in advance.</p>