title: Cascade Delete Entity within entity
body: <p>I have been working on a project and I'm trying to get the cascade delete to kick in. I have a model below I use for comments. These comments can have replies that come off of them that call the comment class. What I'm trying to do is to make it delete all the replies that can flow off the comment. </p>
  
  <p>Comment -> Reply -> Reply -> Reply -> so on.</p>
  
  <p>If I'm going about this in the wrong direction, please let me know. I have tried to research into this but all I come up with is One-to-One and One-Many cascade codes. I'm using CodeFirst with MVC 4 to build my project. </p>
  
  <p><strong>Edited</strong></p>
  
  <pre><code>public class Comment
      {
          // Properties
          public long Id { get; set; }
  
          [Required]
          [StringLength(250, ErrorMessage = "{0} must be between {1} and {2} characters", MinimumLength = 2)]
          public string Body { get; set; }
  
          [Required]
          public DateTime CreateDate { get; set; }
  
          [Required]
          [InverseProperty("Comments")]
          public User Author { get; set; }
  
          [InverseProperty("CommentCount")]
          public Blog Blog { get; set; }
  
          public bool Hidden { get; set; }
  
          public long RepliesId { get; set; }
  
          [InverseProperty("Replies")]
          public virtual Comment Comments { get; set; }
  
          [InverseProperty("Comments")]
          public virtual ICollection&lt;Comment&gt; Replies { get; set; }
  
          public virtual ICollection&lt;Vote&gt; Votes { get; set; }
  
          public Comment()
          {
              CreateDate = DateTime.UtcNow;
              Hidden = false;
          }
      }
  </code></pre>
  
  <p>Here is my DataContextInitializer</p>
  
  <pre><code>protected override void OnModelCreating(DbModelBuilder modelBuilder)
      {
          modelBuilder.Entity&lt;Comment&gt;().HasMany(i =&gt; i.Replies)
              .WithOptional(i =&gt; i.Comments)
              .HasForeignKey(i =&gt; i.RepliesId)
              .WillCascadeOnDelete();
      }
  </code></pre>