I have a edmx containing of an entity “School”.
“School” contains a List of “Standards”, which contain a List of “Sections”, which in-turn contains a list of “Students”

I was finding it difficult to delete any entity which contained a reference to another entity
The error was one related to referential integrity.
I tried to manually delete each of the contained inner objects, viz, all Sections under a Standard, but even after the deletion and a call to SaveChanges(), still the same error persisted.
Finally added Cascade Delete option to the master tables through scripts. This did the trick and I was allowed to delete master elements after this..
Sample Cascade delete script:
ALTER TABLE [dbo].[Standard]
WITH NOCHECK ADD CONSTRAINT [FK_Standard_Sections] FOREIGN KEY([StandardId) REFERENCES [dbo].[Sections] ([ID])
ON DELETE CASCADE
GO
“School” contains a List of “Standards”, which contain a List of “Sections”, which in-turn contains a list of “Students”
I was finding it difficult to delete any entity which contained a reference to another entity
The error was one related to referential integrity.
I tried to manually delete each of the contained inner objects, viz, all Sections under a Standard, but even after the deletion and a call to SaveChanges(), still the same error persisted.
Finally added Cascade Delete option to the master tables through scripts. This did the trick and I was allowed to delete master elements after this..
Sample Cascade delete script:
ALTER TABLE [dbo].[Standard]
WITH NOCHECK ADD CONSTRAINT [FK_Standard_Sections] FOREIGN KEY([StandardId) REFERENCES [dbo].[Sections] ([ID])
ON DELETE CASCADE
GO