I have an Album (BusinessBase) that has a Photos property (BusinessListBase). These corrolate directly to an album table and a photo table. Where the photo table has an albumId field that is a FK to the id in the album table.
I am unclear as to the proper way to delete the album and the associated photos.
In code, I am looping through the list of photos and then for each photo, calling:
Once the loop has finished, I then mark the album as deleted:
And finally commit my changes:
album = album.Save();
When I do this, it first attempts to delete the Album record, which causes integrity problems since the photos still reference the album.
Typically your DataPortal_DeleteSelf would do one of the following:
I took the third approach. From within
DataPortal_DeleteSelf()I am calling UpdateChildren before I called the album's delete method in the DAL.
Copyright (c) Marimer LLC