You raise an excellent point.
Blocking deletes on categories which have articles assigned to them would probably be safest, if you intend to handle this at the database level.
There is a school of thought that holds that all referential integrity should be exposed by the DAL and not buried in the database at all, which I tend to agree with. If you did that, it would be easy to establish rules like what you've suggested:
"When deleting a category, if any Articles belong to that Category, set those Articles to Uncategorized".
|