title: One to Many and One to One on same entities
body: <p><strong>Business Case</strong></p>
  
  <p>We have a shirt that can be ordered in several different colors: Yello; White; Orange; Blue; Green; Red;
  However, only one color can be selected as the default for a shirt.</p>
  
  <p><strong>Implementation</strong></p>
  
  <p>Here is what I have so far:</p>
  
  <pre><code>public class Shirt
  {
      public int Id { get; set; }
  
      public string Sku { get; set; }
      public string Description { get; set; }
  
      public Color DefaultColor { get; set; }
  
      public ICollection&lt;Color&gt; AvailableColors { get; set; }
  }
  
  public class Color
  {
      public int Id { get; set; }
  
      public string ColorCode { get; set; }
      public string Name { get; set; }
      public string HexCode { get; set; }
  
      public int ShirtId { get; set; }
      public virtual Shirt Shirt { get; set; }
  }
  
  
  public class ShirtContext : DbContext
  {
      public ShirtContext() : base("name=DefaultConnection") { }
      public DbSet&lt;Shirt&gt; Shirts { get; set; }
      public DbSet&lt;Color&gt; Colors { get; set; }
  
      protected override void OnModelCreating(DbModelBuilder modelBuilder)
      {
          modelBuilder.Entity&lt;Shirt&gt;()
              .HasRequired(c =&gt; c.DefaultColor)
              .WithRequiredDependent(c =&gt; c.Shirt);
  
          modelBuilder.Entity&lt;Color&gt;()
              .HasRequired(c =&gt; c.Shirt)
              .WithMany(o =&gt; o.AvailableColors)
              .WillCascadeOnDelete();
  
          base.OnModelCreating(modelBuilder);
      }
  }
  </code></pre>
  
  <p><strong>Issue</strong></p>
  
  <p><code>System.Data.Entity.Core.MetadataException: 'Schema specified is not valid. Errors: The relationship 'ShirtPortal.Data.Color_Shirt' was not loaded because the type 'ShirtPortal.Data.Color' is not available.'</code></p>
  
  <p>Can I please have assistance in setting up the foreign key relationship in my entities to match my business case?</p>