title: Entity Framework Multiple Collections of Same Type
body: <p>I am trying to create a class with two collections of the same type. However when I read one of the collections, I get data from both. Which means, there must be something wrong with my Fluent API configuration.</p>
  
  <p>In LINQPad, I can see that the collections "Alternatives" and "Answers" has been combined into a single "PageElements"-collection.</p>
  
  <p><strong>Sample Code</strong></p>
  
  <pre><code>class Program
  {
      static void Main(string[] args)
      {
          var alternatives = new List&lt;PageElement&gt;
              {
                  new PageElement {Data = "Alternative 1"},
                  new PageElement {Data = "Alternative 2"},
                  new PageElement {Data = "Alternative 3"},
                  new PageElement {Data = "Alternative 4"},
              };
  
          var answers = new List&lt;PageElement&gt;
              {
                  new PageElement { Data = "Answer 1" },
                  new PageElement { Data = "Answer 2" },
              };
  
          var page = new Page
              {
                  Alternatives = alternatives,
                  Answers = answers
              };
  
  
          using (var context = new MyContext())
          {
              context.Pages.Add(page);
              context.SaveChanges();
  
              var loadedPage = context.Pages.First();
  
              foreach (var answer in loadedPage.Answers)
              {
                  Console.WriteLine("Answer: " + answer.Data);
              }
  
          }
  
  
          Console.ReadLine();
      }
  }
  
  
  
  public class MyContext : DbContext
  {
      public DbSet&lt;Page&gt; Pages { get; set; }
  
      public MyContext()
      {
  
      }
  
      protected override void OnModelCreating(DbModelBuilder mb)
      {
  
          mb.Entity&lt;PageElement&gt;()
            .HasRequired(p =&gt; p.Page)
            .WithMany(p =&gt; p.Alternatives)
            .HasForeignKey(p =&gt; p.PageId);
  
          mb.Entity&lt;PageElement&gt;()
            .HasRequired(p =&gt; p.Page)
            .WithMany(p =&gt; p.Answers)
            .HasForeignKey(p =&gt; p.PageId);
  
      }
  
  }
  
  public class Page
  {
      public int Id { get; set; }
      public virtual ICollection&lt;PageElement&gt; Alternatives { get; set; }
      public virtual ICollection&lt;PageElement&gt; Answers { get; set; }
  }
  
  public class PageElement
  {
      public int Id { get; set; }
      public int PageId { get; set; }
      public virtual Page Page { get; set; }
  
      public string Data { get; set; }
  }
  </code></pre>
  
  <p><strong>Output</strong></p>
  
  <pre><code>Answer: Alternative 1
  Answer: Alternative 2
  Answer: Alternative 3
  Answer: Alternative 4
  Answer: Answer 1
  Answer: Answer 2
  </code></pre>
  
  <p><strong>Desired Output</strong></p>
  
  <pre><code>Answer: Answer 1
  Answer: Answer 2
  </code></pre>