Products

Solutions

Resources

Partners

Community

Blog

About

QA

Ideas Test

New Community Website

Ordinarily, you'd be at the right spot, but we've recently launched a brand new community website... For the community, by the community.

Yay... Take Me to the Community!

Welcome to the DNN Community Forums, your preferred source of online community support for all things related to DNN.
In order to participate you must be a registered DNNizen

HomeHomeArchived Discus...Archived Discus...Developing Under Previous Versions of .NETDeveloping Under Previous Versions of .NETASP.Net 2.0ASP.Net 2.0clean up after "Delete"clean up after "Delete"
Previous
 
Next
New Post
12/17/2006 4:47 PM
 

I've just run into the same need for a well-defined interface that when implemented by a module's business controller class would allow a module instance to perform database cleanup at the time a module (or page containing the module) is deleted from the recycle bin.  I'm developing a prayer request and update module for church websites - it's much like a specialized forum - that creates entries in 9 tables plus makes entries to the ModuleSettings and UserProfile tables. Different groups/ministries in the church will be able to place distinct instances of the module on their own page(s). As groups/ministries come and go, I forsee that that instances of this module or pages on which it was placed will be frequently created then later deleted leaving considerable garbage in the various tables. Although I will provide the usual SQL uninstall stript to be run when the module definition is deleted, I don't see any way to trigger cleanup of associated table data (keyed to ModuleId at its top level) when a module instance is deleted.  For now I will probably have to implement a manually triggered cleanup in an associated administration module.

I vote for the addition of an IDisposable (or whatever it will be called) interface to be defined in the core, much like IPortable, ISearchable, etc.


Bill, WESNet Designs
Team Lead - DotNetNuke Gallery Module Project (Not Actively Being Developed)
Extensions Forge Projects . . .
Current: UserExport, ContentDeJour, ePrayer, DNN NewsTicker, By Invitation
Coming Soon: FRBO-For Rent By Owner
 
New Post
12/17/2006 6:45 PM
 

You dont need any extra code to do this.  All you need to do is make sure that when you construct your database tables you enable cascade delete from the moduleID.  That way when the module is permanently deleted from the Recycle Bin any related records are also deleted from the database.

So make sure yu include the ModuleID column in the correct custom tables so you can do this.


Philip Beadle - Employee
 
New Post
12/17/2006 8:04 PM
 
Thanks Phil . . . the light comes on! I knew that the delete of a module from the Modules table could cascade to my custom top level table but had forgotten that with proper foreign key relationships AND with cascade deletes properly enabled, the deletion could then cascade to other related tables.  I'll need to work on the foreign key relationships a bit more and may have to add a ModuleId column to a couple of lookup tables. Thanks again.

Bill, WESNet Designs
Team Lead - DotNetNuke Gallery Module Project (Not Actively Being Developed)
Extensions Forge Projects . . .
Current: UserExport, ContentDeJour, ePrayer, DNN NewsTicker, By Invitation
Coming Soon: FRBO-For Rent By Owner
 
New Post
12/18/2006 2:08 AM
 

Good that the answer is found.

So how can I manage this - deleting from my custoum tables, when a module is removed from the recycling bin ?

Is there a little sample avaiable?

BW

 
New Post
12/18/2006 4:46 AM
 

Although in general, it is very easy to add a foreign key with cascade deleting in sql, one of the rather big problems is that if something ever changes in the modules table (ie, a change in the definition of the table), your module might break. Using a trigger might be safer..

books online will tell you something more about cascading delete constraints: http://msdn2.microsoft.com/en-us/library/ms188066.aspx


Erik van Ballegoij, Former DNN Corp. Employee and DNN Expert

DNN Blog | Twitter: @erikvb | LinkedIn: Erik van Ballegoij on LinkedIn

 
Previous
 
Next
HomeHomeArchived Discus...Archived Discus...Developing Under Previous Versions of .NETDeveloping Under Previous Versions of .NETASP.Net 2.0ASP.Net 2.0clean up after "Delete"clean up after "Delete"


These Forums are dedicated to discussion of DNN Platform and Evoq Solutions.

For the benefit of the community and to protect the integrity of the ecosystem, please observe the following posting guidelines:

  1. No Advertising. This includes promotion of commercial and non-commercial products or services which are not directly related to DNN.
  2. No vendor trolling / poaching. If someone posts about a vendor issue, allow the vendor or other customers to respond. Any post that looks like trolling / poaching will be removed.
  3. Discussion or promotion of DNN Platform product releases under a different brand name are strictly prohibited.
  4. No Flaming or Trolling.
  5. No Profanity, Racism, or Prejudice.
  6. Site Moderators have the final word on approving / removing a thread or post or comment.
  7. English language posting only, please.
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out