We are trying to figure out a way to mark an entity for deletion so that it is not deleted until the Save() method is executed on the Entity (instead of deleting itself immediatly from the database). This is for issues of being able to rollback changes, and not having to commit the deletion until the save event.
We added a MarkForDelete() property in our EntityBase we inherit from, and we read that property by overriding the OnSave event. It checks if it is MarkForDelete() = True then it does a Me.Delete().
Our issue is that we are also adding new entities that have the same unique constraints in the database. So if the entity that is new is saved before the old entity is deleted, we will hit the Unique constraint.
The main saves that are used are trickled down to all children using Entity.Save(True). So basically we need a way to make sure the Save process is ran on all entities that are MarkForDelete = True first, so new entities with an identical unique constraint don't have to worry about those still being in the database.
I hope this makes sense haha.