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.0Delete module rows from module tables when module is deletedDelete module rows from module tables when module is deleted
Previous
 
Next
New Post
11/13/2007 10:38 AM
 

Hello everybody,

I'm creating a C# module. I' d like that, when the module is deleted from a page and then deleted from the Recycle Bin, all the rows related to that module are deleted from module tables.

How can I do this?

 
New Post
11/13/2007 4:54 PM
 

Most developers will create a foreign key constraint between the ModuleID column of their custom table(s) and the ModuleID column of the DNN Modules table with Cascade Deletes turned on.  When the module instance is deleted from the DNN Modules table (when finally deleted from the Recycle bin), all related table records for this ModuleID should also be deleted. I've generally followed this pattern but don't feel entirely comfortable with it - when I think of the potentially hundreds of module definitions creating foreign key constraints on the DNN Modules table. I keep meaning to look into doing this with a sql trigger rather than foreign key constraint but can't seem to get around to it.  Any one tried this? Pros . . . cons?

Other developers prefer to leave orphaned data in their custom tables when a module instance is deleted figuring that all of their custom tables will be deleted anyway when the module definition itself is deleted - thanks to the UnInstall.SqlDataProvider script that should be included in each module package.


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
11/14/2007 1:45 AM
 

Any module shall care for maintaining its data including deletion, when the module is deleted. Using a trigger is preferable to a foreign key, as it does less limit the core to alter layout of the core tables. Ideally deletion would be handled by business logic.


Cheers from Germany,
Sebastian Leupold

dnnWerk - The DotNetNuke Experts   German Spoken DotNetNuke User Group

Speed up your DNN Websites with TurboDNN
 
New Post
11/14/2007 3:02 AM
 

Hello!

William, your explanation is very clear, thank you very much!

Sebastian, thank you for your response, could you please give me an example on how to use a trigger? Or could you suggest me a module that use this method? What do you mean with "deletion would be handled by business logic"?

 
New Post
11/14/2007 11:34 AM
 

Sebastian Leupold wrote

Any module shall care for maintaining its data including deletion, when the module is deleted. Using a trigger is preferable to a foreign key, as it does less limit the core to alter layout of the core tables. Ideally deletion would be handled by business logic.

I agree with this entirely, however the core doesn't implement ANY method for a developer to use business logic to delete data upon module instance deletion!

Edit: to clarify module INSTANCE and not the package itself.


-Mitchel Sellers
Microsoft MVP, ASPInsider, DNN MVP
CEO/Director of Development - IowaComputerGurus Inc.
LinkedIn Profile

Visit mitchelsellers.com for my mostly DNN Blog and support forum.

Visit IowaComputerGurus.com for free DNN Modules, DNN Performance Tips, DNN Consulting Quotes, and DNN Technical Support Services
 
Previous
 
Next
HomeHomeArchived Discus...Archived Discus...Developing Under Previous Versions of .NETDeveloping Under Previous Versions of .NETASP.Net 2.0ASP.Net 2.0Delete module rows from module tables when module is deletedDelete module rows from module tables when module is deleted


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