Hello Tilovell,
Thank you for the great feedback. You are correct both on the fact that EF differentiates between removing an entity from a collection and deleting the entity itself, and on the fact that there is a behavior missing that could make EF easier to use in this kind of scenario. We usually talk about this behavior as "delete orphans" and consists on the ability to delete automatically (given some kind of annotation in the association and/or convention) the entities that have become "orphaned" if at the time SaveChanges is invoked they have not been re-parented. This something that I would really like us to support, but it has never bubbled up to the top of the list simply because we have had many other features in our roadmap. I would like to encourage you to vote for it in our UserVoice site:
http://data.uservoice.com/forums/72025-entity-framework-feature-suggestions/suggestions/1263145-delete-orphans-support
Thanks,
Diego
Thank you for the great feedback. You are correct both on the fact that EF differentiates between removing an entity from a collection and deleting the entity itself, and on the fact that there is a behavior missing that could make EF easier to use in this kind of scenario. We usually talk about this behavior as "delete orphans" and consists on the ability to delete automatically (given some kind of annotation in the association and/or convention) the entities that have become "orphaned" if at the time SaveChanges is invoked they have not been re-parented. This something that I would really like us to support, but it has never bubbled up to the top of the list simply because we have had many other features in our roadmap. I would like to encourage you to vote for it in our UserVoice site:
http://data.uservoice.com/forums/72025-entity-framework-feature-suggestions/suggestions/1263145-delete-orphans-support
Thanks,
Diego