We perform delete function on EntityName by calling the DeleteAsync on the repository EntityNameRepository.
However EntityName has a number of child tables. DeleteAsync sets the IsDeleted value to true for the EntityName however that doesn't happen for the child entities of EntityName.
How to cascade delete all entities associated with  EntityName
12 Answer(s)
- 
    0hi https://github.com/abpframework/abp/issues/9366#issuecomment-869247128 
- 
    0Hi maliming :) Thanks for the reply. I was checking out the github link you shared. I tried to add the override for deleteasync just like how we did for the WithDetailsAsync but that didn't work out. Do you have any reference code which we can refer to that extends deleteasync to soft delete the subcollections ? Thank you 
- 
    0but that didn't work out. Can you explains why it doesn't work? 
- 
    0
- 
    0You can see the DeleteAsyncmethod in base class.https://github.com/abpframework/abp/blob/dev/framework/src/Volo.Abp.EntityFrameworkCore/Volo/Abp/Domain/Repositories/EntityFrameworkCore/EfCoreRepository.cs#L186 https://github.com/abpframework/abp/blob/dev/framework/src/Volo.Abp.EntityFrameworkCore/Volo/Abp/Domain/Repositories/EntityFrameworkCore/EfCoreRepository.cs#L439 
- 
    0so do we have to call deleteasync mulltiple times to delete subcollections? how do we go on and soft delete multiple subcollection. i tried x =>x.Id == id inside deleteasync but it deletes only the main record. 
- 
    0Hi maliming, awaiting your support. Thank you :) 
- 
    0Hi maliming, guess you're having a busy day. We all have them ;) Waiting for your reply. Thank you. 
- 
    0hi Can you share your app source code again? liming.ma@volosoft.com 
- 
    0hey, i've sent you the request to the repo. Tx :) 
- 
    0
- 
    0Thanks maliming :) . I used separate repos for each of those collections as suggested and was able to set isdeleted as true. Thank you 


 
                                