I\'ve just started using EF code first, so I\'m a total beginner in this topic.
I wanted to create relations between Teams and Matches:
1 match = 2 teams (ho
This is because Cascade Deletes are enabled by default. The problem is that when you call a delete on the entity, it will delete each of the f-key referenced entities as well. You should not make 'required' values nullable to fix this problem. A better option would be to remove EF Code First's Cascade delete convention:
modelBuilder.Conventions.Remove();
It's probably safer to explicitly indicate when to do a cascade delete for each of the children when mapping/config. the entity.