Deletion without cascading

Jun 21, 2012 at 11:39 AM
Edited Jun 21, 2012 at 11:46 AM


I have been going through this pattern and it is indeed some nice work.

I am very new to entity framework and I have the following question;

Using this pattern, how will I be able to delete parent and child records if cascade delete is set to false in the model. For example if in my model I have Parent Table A and Child table A, Child table C, how would i go about deleting child entities if I delete the parent entity.

I am using database first model for a webform application


Jun 25, 2012 at 10:14 PM

Hi mkamransari,

i guess there won't be any simple solution, as you don't want to use the common way (cascade delete).

Anyway, I'll try to implement an example tomorrow.

Jun 25, 2012 at 11:23 PM

Hi Fab,

Thanks. I have more question to add. I am using entity framework in web forms. What is the recommended way of dealing with child entities with unit of work. Lets say, I have a customer entity and would like to update the Address & Other Details (two separate tables). Should I fetch the address object and other details object using individual repositories i.e. AddressRepository & OtherDetailsRepository and update the object and finally do a commit?