Delete Parent With A ChildDelete Parent With A Child
Old forum URL: forums.lhotka.net/forums/t/7381.aspx
goyo posted on Saturday, August 01, 2009
how to Delete a Parent with its Child
JonnyBee replied on Saturday, August 01, 2009
Hi,
There are several alternatives.
1. Use "cascading delete" constraint in your DB. No need to worry about this in your BO.
2. Use a SP in database that handles deleting parent and children
3. Programatically handle the delete operation to make sure to delete all children before deleting parent.
I would prefer either 1 or 2 - You should not have to rely on loading your domainmodel (parent and possibly a lot of children) into memory to be sure to delete all children in DB.
/jonnybee
Copyright (c) Marimer LLC