title: How to work with collections
body: <p>Can anyone write mini-guide which explains how to work with collections in EF?</p>
  
  <p>For example I have following models:
  </p>
  
  <pre><code>public class BlogPost
  {
      public int Id { get; set; }
      public string Title { get; set; }
      public string Content { get; set; }
      public DateTime DateTime { get; set; }
      public List&lt;PostComment&gt; Comments { get; set; }
  }
  
  public class PostComment
  {
      public int Id { get; set; }
      public BlogPost ParentPost { get; set; }
      public string Content { get; set; }
      public DateTime DateTime { get; set; }
  }
  </code></pre>
  
  <p>And context class:</p>
  
  <pre><code>public class PostContext : DbContext
  {
      public DbSet&lt;BlogPost&gt; Posts { get; set; }
      protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
      {
          optionsBuilder.UseSqlServer(@"Server=(localdb)\mssqllocaldb;Database=Posts;Trusted_Connection=True;MultipleActiveResultSets=true");
  
      }
      protected override void OnModelCreating(ModelBuilder builder)
      {
          base.OnModelCreating(builder);
  
      }
  }
  </code></pre>
  
  <p>What do I need to write in OnModelCreating method so that I can use Posts.Add and etc. everywhere in my code?</p>