ASP.NET MVC. How manually add "cascade delete" to a code first relationship?
<p>How to configure a cascade delete to an Code First Project without setting the navigation properties to [Required] or non nullable ?</p>

<p>for instance: </p>

<pre><code>class MainClass{
    [Key] int id {get;set;}
    public string name {get;set;}
    public virtual ICollection&lt;SubItem&gt; subItems {get;set}
}
</code></pre>

<p>and</p>

<pre><code>Class SubItem{
    [Key] int id {get; set;}
    public string name {get;set;}
}
</code></pre>

<p>Deleting the main class should delete all related SubItems</p>