Delete an Entity and its entire graph of related entities

Posts   
 
    
Aidan
User
Posts: 8
Joined: 20-Mar-2006
# Posted on: 23-Mar-2006 18:58:47   

Hi

Using self Service I have an created an entity and I want to delete it and delete any related entities from the database - is this possible ??

for example

MyEntity foo = new MyEntity(); foo .FetchUsingPK(123); foo .Delete();

This will throw an exception if any foreign keys in the database are violated ... Is there a smart way to load an entire object graph into memory and perform a cascading delete on an entity ??

Thanks

bclubb
User
Posts: 934
Joined: 12-Feb-2004
# Posted on: 24-Mar-2006 04:19:16   

The most common way to do this would be to use cascading deletes in the database. I haven't implemented this type of functionality in code.

Aidan
User
Posts: 8
Joined: 20-Mar-2006
# Posted on: 24-Mar-2006 09:56:22   

bclubb wrote:

The most common way to do this would be to use cascading deletes in the database. I haven't implemented this type of functionality in code.

thanks !!