DNN Forums

Ask questions about your website to get help learning DNN and help resolve issues.

Extending Globals class

 6 Replies
 1 Subscribed to this topic
 26 Subscribed to this forum
Sort:
Author
Messages
Growing Member
Posts: 69
Growing Member

Hello,
I need to extend the sealed class Globals.
My former colleagues have modified the class directly, but honestly I do not consider the best way...
I need to add properties and the practice would be for me to create an Adapter class. Then I have to add some methods and redefine others and in this case I have to write an Extension class.
The question is: what is the best way to achieve the 2 things possibly using only one class?

Thanks
S.

Growing Member
Posts: 69
Growing Member

Actually, I need to do this with other classes.
Sealed and not.

Thanks

Senior Member
Posts: 1607
Senior Member
MVP
MVP
You're an MVP!
New Poster
New Poster
Congrats on posting!
Which class(es), specfically, are you trying to edit? Globals where?
Growing Member
Posts: 69
Growing Member

Hi!
DotNetNuke.Common.Globals
DotNetNuke.Framework.JavaScriptLibraries.JavaScript
...and potentially others that I haven't discovered yet

Thanks
S.

Senior Member
Posts: 1607
Senior Member
MVP
MVP
You're an MVP!
New Poster
New Poster
Congrats on posting!
Posted By Seek on 1/31/2023 12:14 AM

Hi!
DotNetNuke.Common.Globals
DotNetNuke.Framework.JavaScriptLibraries.JavaScript
...and potentially others that I haven't discovered yet

Thanks
S.

Are you trying to actually change the code you've listed, or are you trying to execute your own code at specific points in time?  If it's the latter, what are the specific moments when you need your code to run? 

 

Growing Member
Posts: 69
Growing Member

I try to be more specific.
As I wrote, I found many changes in the source code of DNN, wich add properties and methods.
Now I'm migrating DNN modules from version 7.4 to version 9.11 and would like to avoid such practices.
What I want to know is if there is an alternative method to directly modifying the DNN code.

S.

Senior Member
Posts: 1607
Senior Member
MVP
MVP
You're an MVP!
New Poster
New Poster
Congrats on posting!

Ah....  Too many forum posts I've been looking at.  

The answer is, it depends...  Nearly everything can have a different method of implementation.  Each chunk of code may need to be looked at slightly differently.  With DNN, you have tons of ways to get code to run, via theme objects, theme layouts, modules, scheduled jobs, event triggers, providers of various kinds, libraries, etc.  You may find yourself splitting some of the code up, while keeping other bits together.  

These Forums are for the discussion of the open source CMS DNN platform and ecosystem.

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

  1. If you have (suspected) security issues, please DO NOT post them in the forums but instead follow the official DNN security policy
  2. No Advertising. This includes the promotion of commercial and non-commercial products or services which are not directly related to DNN.
  3. 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.
  4. Discussion or promotion of DNN Platform product releases under a different brand name are strictly prohibited.
  5. No Flaming or Trolling.
  6. No Profanity, Racism, or Prejudice.
  7. Site Moderators have the final word on approving / removing a thread or post or comment.
  8. English language posting only, please.

Would you like to help us?

Awesome! Simply post in the forums using the link below and we'll get you started.

Get Involved