title: Entity Framework one-to-one relationship with one being optional throws error
body: <p>I have a Product class:</p>
  
  <pre><code>public class Product
  {
      public int ID { get; set; }
  
      [Required]
      public string Name { get; set; }
      public decimal Price { get; set; }
  
      public Offer Offer { get; set; }
  }
  </code></pre>
  
  <p>And an Offer class: </p>
  
  <pre><code>public class Offer
  {
      public int ID { get; set; }
  
      [Required]
      public DateTime DateFrom { get; set; }
      public DateTime DateTo { get; set; }
      public decimal OfferPrice { get; set; }
      public Product Product { get; set; }
  }
  </code></pre>
  
  <p>Basically want I want to achieve is when an offer is added a Product is related to this Offer. So an Offer always has a Product but a Product does not always need an Offer. If the Product does have an Offer I'd like to be able to access it through <code>Product.Offer</code>, but in this setup I get the following error message when updating the database:</p>
  
  <blockquote>
    <p>Unable to determine the principal end of an association between the types 'WebshopISEC.Models.Offer' and 'WebshopISEC.Models.Product'. The principal end of this association must be explicitly configured using either the relationship fluent API or data annotations.</p>
  </blockquote>
  
  <p>I've tried a lot of things (data annotations and Fluent API) and searched endlessly but I cannot seem to solve this issue. A Fluent API approach I've tried:</p>
  
  <pre><code>modelBuilder.Entity&lt;Offer&gt;()
              .HasRequired(x =&gt; x.Product)
              .WithOptional(x =&gt; x.Offer);
  </code></pre>
  
  <p>But this worked to no avail, how do I assign a Principal End? And to what class?</p>