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:
album.PhotoList.Remove(photo);
Once the loop has finished, I then mark the album as deleted:
album.Delete();
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.
Any suggestions?
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.
FieldManager.UpdateChildren(this);
Copyright (c) Marimer LLC