title: Entity Framework Core not loading related data from reference table
body: <p>MY Model <code>M:M</code> relationship Reference to
  <a href="https://www.entityframeworktutorial.net/efcore/configure-many-to-many-relationship-in-ef-core.aspx" rel="nofollow noreferrer">https://www.entityframeworktutorial.net/efcore/configure-many-to-many-relationship-in-ef-core.aspx</a></p>
  <p><strong>Models</strong></p>
  <pre><code>public class Post
  {
      [Key]
      public int Id { get; set; }
      [Display(Name = &quot;Created By:&quot;)]
      public AppUser AuthorId { get; set; }
      [Required]
      public string Title { get; set; }
      public string metaTitle { get; set; }
      [Required]
      public string Body { get; set; }
      public bool Published { get; set; } 
      public bool ISFeatured { get; set; }
      public DateTime CretedDate { get; set; } = DateTime.Now;
      public DateTime ModifiyDate { get; set; } = DateTime.Now;
      public IList&lt;Comment&gt; Comments { get; set; }
      public IList&lt;PostTag&gt; PostTag { get; set; }
      public IList&lt;PostCategory&gt; PostCategory { get; set; }
      public IList&lt;Images&gt; Images { get; set; }
  
  }
  
  public class Tag
  {
      [Key]
      public int Id { get; set; }
      [Required]
      public string Name { get; set; }
      public bool Published { get; set; } = true;
      public DateTime CretedDate { get; set; } = DateTime.Now;
      public DateTime ModifiyDate { get; set; } = DateTime.Now;
      public IList&lt;PostTag&gt; PostTag { get; set; }
      public IList&lt;Images&gt; Images { get; set; }
  
  
  }
  
  public class PostTag
  {
  
      public int TagId { get; set; }
     
      public int PostId { get; set; }
  
      public Post Post { get; set; }
  
      public Tag Tag { get; set; }
      public AppUser AppUser { get; set; }
  
  }
  </code></pre>
  <p><strong>DB context</strong></p>
  <pre><code>modelBuilder.Entity&lt;Post&gt;()
          .HasMany(c =&gt; c.Comments)
          .WithOne(e =&gt; e.Post);
  
  modelBuilder.Entity&lt;PostCategory&gt;().HasKey(p =&gt; new
  {
      p.PostId,p.CategoryId
  });
  
  modelBuilder.Entity&lt;PostCategory&gt;()
      .HasOne(p =&gt; p.post).
      WithMany(p =&gt; p.PostCategory).
      HasForeignKey(p =&gt; p.PostId);
  
  modelBuilder.Entity&lt;PostCategory&gt;().
      HasOne(p =&gt; p.Category).
      WithMany(p =&gt; p.PostCategory).
      HasForeignKey(p =&gt; p.CategoryId);
  </code></pre>
  <p>On the controller, side fetching all posts, it is bringing all the posts but not getting any data from the related tables. Example Tags, Categories</p>
  <p><strong>Controller</strong></p>
  <pre><code>public async Task&lt;IActionResult&gt; Index()
  {
      return View(await _context.Post.ToListAsync());
  }
  </code></pre>
  <p><a href="https://i.stack.imgur.com/xiTBb.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/xiTBb.png" alt="enter image description here" /></a></p>
  <p>Update Action</p>
  <p><a href="https://i.stack.imgur.com/Jna0w.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Jna0w.png" alt="enter image description here" /></a></p>
  <p>Tags reference is empty</p>
  <p><a href="https://i.stack.imgur.com/xvMMS.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/xvMMS.png" alt="enter image description here" /></a></p>