title: Cascade delete in table per type(TPT) EF Core 5
body: <p>I have two entities employee manager and I am using <strong>ef core 5</strong>.</p>
  <pre><code>public class Employee
  {
          public long Id{ get; private set; }
          public string FirstName { get; private set; }
          public string LastName { get; private set; }
  }
  
  public class Manager : Employee
  {
          public long StoreId{ get; private set; }
  }
  </code></pre>
  <p>I am using type per table, using fluent api</p>
  <pre><code>class EmployeeConfiguration : IEntityTypeConfiguration&lt;Employee&gt;
      {
  
          public void Configure(EntityTypeBuilder&lt;Employee&gt; builder)
          {
              builder.ToTable(&quot;Employee&quot;);
              builder.HasKey(x =&gt; x.Id);    
  
          }
      }
  
  class ManagerConfiguration : IEntityTypeConfiguration&lt;Manager&gt;
      {
  
          public void Configure(EntityTypeBuilder&lt;Manager&gt; builder)
          {
              builder.ToTable(&quot;Manager&quot;);
          }
      }
  </code></pre>
  <p>As a result I have two tables. The problem is, i want a cascade on delete behavior, when I remove the employee , I want to remove and the record of the manager table.
  But the default behavior is not this. When i try to delete the parent record I have a fk violation</p>
  <p>How i can configure the OnDelete in a table per type case?</p>
  <p>EDIT
  EF core understand the relationship and after the migration generate</p>
  <pre><code>b.HasOne(&quot;.......Employee&quot;, null)
                          .WithOne()
                          .HasForeignKey(&quot;....Manager&quot;, &quot;Id&quot;)
                          .OnDelete(DeleteBehavior.ClientCascade)
                          .IsRequired();
  </code></pre>