title: One-to–Zero-or-One relationship, with self
body: <p>I have the following entity:</p>
  
  <pre><code>public class Category
  {
    public int ID { get; set; }    
    public int? ParentID { get; set; }
    public string Name{ get; set; }
    public virtual Category Parent { get; set; }
  }  
  </code></pre>
  
  <p>to which I'm trying to define a relationship: a <code>Category</code> can optionally have a parent category.<br>
  I've already defined the primary key:  </p>
  
  <pre><code>HasKey(m =&gt; m.ID);  
  </code></pre>
  
  <p>I've read <a href="http://msdn.microsoft.com/en-us/data/jj591620.aspx" rel="nofollow">this</a> example, which includes a One-to–Zero-or-One relationship, but I can't grasp exactly how <code>HasRequired</code> implies an entity is optional in a relationship.</p>