Deleting Objects from a Domain Model in a safe and scalable way with minimal adverse effects, is a thorny problem.
Eric Evans Domain Driven Design book has the best discussion Ive read under the section on Aggregates, but its not comprehensive.
Im struggling to find a really nice solution in Heroes of Arcadia. My best shot so far involves a mixed approach – cleaning out as many root refs as I can, plus stamping the deleted object as inactive. An example:
Units can be removed from a Zone.
There are two primary references to a Unit, via its Faction and its Location. These are bi-directional. When a unit is removed, it notifies its Faction and Location that it is going and they remove their ref to it. As these are the primary indices, cleaning them out will prevent the creation of new refs to the removed unit.
Units may also be referenced from other domain entities uni directionally (meaning they are unaware they’re referenced), for example, by being the target of a spell effect. These refs will remain after the unit is “removed”. The unit must stamp itself as being removed/inactive, and all domain operations need to tolerate this state. Gradually, the removed unit should “drain out” of the system as refs expire.