[eluser]mcnux[/eluser]
[quote author="OverZealous" date="1250183131"]
Well, I'd like to hear other's opinion on this, because somewhat I agree with you. (A lot of this code is not mine, so I don't always have the reasoning behind something.)
[/quote]
Yes understood. Maybe this could be configurable?
[quote author="OverZealous" date="1250183131"]
The only good reason I can see is that deleting the object first allows the Database to handle cascades, which should be significantly faster and safer (transactionally speaking).
If you have foreign constraints, you really should have deletion rules set up to cascade properly. This would prevent those errors. Since DMZ doesn't actually delete any related objects automatically, you still need to determine the correct order to delete objects in.[/quote]
I'm reluctant to let the database handle the cascade as it splits the responsibility of relationship cleanup between the application and the database. I would rather give the responsibility wholly to either the application or the database, otherwise it becomes a little unclear what's doing what.
I still like to have constraints in place within the schema purely to ensure that the database remains in tact, no matter what the application attempts to do.
However, maybe I should be shifting the responsibility to the database. I'll certainly have a think about it.