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.
2 Yeap. If you have cascade delete on your relationships in database, and you bring that into an EF model, the EF will in fact delete dependent entities in memory to attempt to keep the in memory object graph in sync with the database. But you shouldn't rely on EF deleting related all related objects that is the job of the database.
– Alex James Jun 2 '09 at 3:43 Thanks Alex, I was worried that CASCADE DELETE would mess up the in memory state but if EF is keeping it up to date then this works! – LPCRoy Jun 3 '09 at 0:08.
In this article, Alex Jamese (who post his answer), has a complete article on the topic. blogs.msdn.com/b/alexj/archive/2009/08/1....
The cascade delete works in a very strange way in Entity Framework, because even if the relation is set in that mode, Entity executes a delete sentence for each one of the children row associated to the father I want to delete.
Yes, I have found this issue too. It defeats the purpose of having it the cascade delete if EF executes one statement per row. – MikeKulls Aug 15 at 23:45 Just read the above article and it appears that this is the way EF is designed!
Me thinks they've done the old 'lets call this bug a feature' things. – MikeKulls Aug 16 at 0:16.
Product productObj = this.ObjectContext.Product. Where(p => p.ProductID. //my own methods.
A relationship is being added or deleted from an AssociationSet 'FK_ProductCategory_Product'. With cardinality constraints, a corresponding 'ProductCategory' must also be added or deleted.
I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.