How can I implement Cascade Delete in a self referencing table in EF Core 2 (code first)?
(For example there is a Comment Table and man can reply to a comment and this reply can reply by another.)
public class Comment
{
public virtual int Id { get; set; }
public virtual int? ParentId { get; set; }
public Comment Parent { get; set; }
public virtual IList<Comment> Replies { get; set; }
public virtual string Description { get; set; }
public virtual Article Article { get; set; }
}
The problem solved by recursive method: