View Single Post
 
Old April 30th, 2009, 07:15 PM
Lee Dumond's Avatar
Lee Dumond Lee Dumond is offline
Wrox Author
Points: 4,942, Level: 29
Points: 4,942, Level: 29 Points: 4,942, Level: 29 Points: 4,942, Level: 29
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jan 2008
Location: Decatur, IL, USA.
Posts: 923
Thanks: 12
Thanked 166 Times in 162 Posts
Default

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".
__________________
Visit my blog at http://leedumond.com
Follow me on Twitter: http://twitter.com/LeeDumond

Code:
if (this.PostHelpedYou)
{
   ClickThanksButton(); 
}