I would like to define recurrent composition relationship. If the boss is removed from the system all his subordinates are removed by cascade update.
By this I mean:
How should I state it in the code?
public class Person{
     public int Id {get;set;}
     public virtual Person Person {get;set}
}
Is that possible in the Entity Framework?

                        
It's not documented anywhere as far as I know, but Entity Framework only creates / updates / deletes entities it has loaded.
So if you load a
Personand delete it, you'll get a foreign key violation error if thisPersonhas subordinates. EF won't update these child records (set their FKs to null) automatically.If however you load a
Personand its subordinates and delete thePerson, EF will nullify each child's foreign key.To make this loading a bit easier, you should modify the
Personclass slightly:Now you can load a
PersonandInclude()itsSubordinates.By the way, you can't specify cascaded delete/update rules because Sql Server doesn't accept cyclic cascade paths.