Open Closed

Disable cascading delete with Fluent API #9858

andry3ag created

Hi Team,

We have recently downloaded the ASP.Net Core 3x with Anguylar 9.x (version 8.6). I want to create a table B which has 2 foreign keys to same ID(primary key) attribute on table A. Both foreign keyscannot be null so when I try to run the update database command I get error about "multiple cascade paths". I have looked and figured out that I need to disable cascading delete with Fluent API for both tables. I have found some examples for entity framework core but I never was able to use any of examples. Can you please share the code for disabling cascade delete for Table A for example?


1 Answer(s)
  • 0
    musa.demir created
    Support Team

    Hi @andry3ag Most of the the time, multiple cascade paths error happens because of the circular dependencies of the entities. To detect the problem on your situtation we should able to see your entities and their relationship configurations. Can you please check that It is an example that may help you.

    If you can not solve your problem with that, can you please share your entities and their relationship configurations(mostly located in dbcontext's OnModelCreating(ModelBuilder modelBuilder) method). If you don't want to share it publicly, you can send them to with that support question url and inform us here.