EF Core many-to-many relation error
This is the error I am getting :
And I don't really know how to fix it.
These are my modals
4 Replies
StudentId in ClassStudent isn't nullable, which would introduce a cyclic cascade paths
And how can I fix that?
If StudentId is not nullable, it means it's required
So let's say you deleted a ClassStudent row, that in turn would delete it's respective Student row, that row references ClassStudents so it'll try to delete them, which in turn tries to delete their respective
Student
and now you have cyclic cascadeThe way to address that: You remove a cascading path. For example, if Delete A -> Delete B and Delete B -> Delete A, you go in either A or B and you say not to cascade the delete.
(Well, not to cascade anything.)