You should not be doing this in the Entity Framework. All popular relational databases support ON CASCADE DELETE
on foreign keys which is a lot more efficient as well. I suggest you just go with that.
More Related Contents:
- How do I view the SQL generated by the Entity Framework?
- how to update an entity in Entity Framework 4 .NET
- Entity Framework 4 selective lazy loading properties
- How to map Table per Type (TPT) inheritance in Entity designer?
- ADO.NET Entity Framework tutorials [closed]
- Entity Framework: One Database, Multiple DbContexts. Is this a bad idea? [closed]
- How can I query for null values in entity framework?
- Entity Framework and SQL Server View
- Batch update/delete EF5
- EntityFramework code-first custom connection string and migrations
- Encrypt password in App.config
- Debug code-first Entity Framework migration codes
- Unique keys in Entity Framework 4
- Introducing FOREIGN KEY constraint may cause cycles or multiple cascade paths
- Entity Framework: Re-finding objects recently added to context
- ObjectContext.Refresh()?
- How do I map a char property using the Entity Framework 4.1 “code only” fluent API?
- combination of two field must be unique in Entity Framework code first approach. how it would?
- EntityFramework Core automatic migrations
- Entity Framework 4.1+ many-to-many relationships change tracking
- what is difference between a Model and an Entity
- Include Grandchildren in EF Query
- Changes in IDENTITY column after EF core 3
- What would cause the Entity Framework to save an unloaded (but lazy loadable) reference over existing data?
- How do I remove underscore of foreign key fields in code first by convention
- Entity Framework Validation confusion – maximum string length of ‘128’
- Number of members in conceptual type does not match with number of members on object side type
- How to delete an object by id with entity framework
- Can anyone spot why I keep getting this error testing the EF 5 beta
- Forcing code-first to always initialize a non-existent database?