title: Many to many navigation property is null
body: <p>I have these two classes in my EF 6 code-first model:</p>
  
  <pre><code>public class Category {
  
      public int CategoryId { get; set; }
  
      [Required, MaxLength( 128 ), Index( IsUnique = true)]
      public string CategoryName { get; set; }
  
      public string Description { get; set; }
  
      public virtual ICollection&lt;Article&gt; Articles { get; set; }
  }
  
  public class Article {
  
      [DatabaseGenerated( DatabaseGeneratedOption.Identity ), Key]
      public int ArticleId { get; set; }
  
      [Required, MaxLength( 128 ), Index( IsUnique = true )]
      public string ArticleName { get; set; }
  
      public virtual ICollection&lt;Category&gt; Categories { get; set; }
  
      public string Description { get; set; }
  
  }
  </code></pre>
  
  <p>I have this code in my data access layer to create a new article:</p>
  
  <pre><code>public Article AddArticle( string articleName, int[] categoryIds ) {
      if ( string.IsNullOrWhiteSpace( articleName ) )
          throw new ArgumentNullException( nameof( articleName ), Properties.Resources.ArticleNameWasNull );
      if ( categoryIds == null )
          throw new ArgumentNullException(nameof(categoryIds), Properties.Resources.CategoryIdsAreNull );
  
      using ( var context = new ArticleContext() ) {
          var article = new Article {
              ArticleName = articleName
          };
          foreach ( var category in context.Categories.Where( c =&gt; categoryIds.Contains( c.CategoryId ) ) )
              article.Categories.Add( category );
          context.Articles.Add( article );
          context.SaveChanges();
          return article;
      }
  }
  </code></pre>
  
  <p>When I call this method, I get a <code>NullReferenceException</code> on the line in the <code>foreach</code> loop that adds the <code>Category</code> object to the <code>article.Categories</code> collection.</p>
  
  <p>Obviously the <code>Categories</code> collection isn't initialized in the call to <code>new Article()</code>.  What am I missing?  </p>