Delete related Entities also

Posts   
 
    
Mennisujay
User
Posts: 11
Joined: 25-Feb-2005
# Posted on: 27-Apr-2005 09:57:20   

hi,

How can i delete all the dependent records also for an Entity. I can delete a single entity jyst saying 'DeleteEntity'. At the same time all the realted records which are in other tables should be deleted.

Any help on this will be greatly appreciated. Urgent help needed. Sujay

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39933
Joined: 17-Aug-2003
# Posted on: 27-Apr-2005 10:19:51   

Everybody needs urgent help, Sujay, we do what we can simple_smile

Deleting all related entities as well, requires a bottom up approach: first delete the related entities, then the top entity, and you can do that using a unit-of-work, or methods like DataAccessAdapter.DeleteEntitiesDirectly(), or store the entities in a collection and delete them in one go, or you could enable Cascading deletes in the database you're using (on the FK constraint). you then delete the pk entity and the RDBMS deletes the rest of the related entities.

cascading deletes aren't supported in llblgen pro, because they can do great harm and it's not always possible to enforce them due to multiple paths to the same entity.

Frans Bouma | Lead developer LLBLGen Pro