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

HomeHomeDevelopment and...Development and...Getting StartedGetting StartedWhats the proper procedure for variable storageWhats the proper procedure for variable storage
Previous
 
Next
New Post
7/6/2010 10:24 AM
 
I have inherited and am working with a DNN application that has multiple modules that all work together. I am trying to optimize the code and arrange it so it is not repetitive and hard to follow. So I am working with Variables that need to be accessed from multiple modules throughout the app. I would like to set this up so I am using the "Norm" procedures. I could use some help to understand the best procedures for variable storage and access.

  • I understand a Session variable is used for each user that logs on for their individual settings? 
  • Application object can be used for what I would call Constants in VB6? These would be accessible to all users. 
  • In the current modules there is a Declaration section that looks like it is used for declaring constant type variables. But a lot of them are repeated in all the modules. Is that a good practice? doesnt that leave me with multiple places to make code changes if a variable changes? Would that be better as an application object setting? Or could they all be declared one time in a file that is shared between multiple modules?
 I would appreciate any help or links to clear tutorials for this.
TIA 
 
New Post
7/6/2010 11:02 AM
 
There really is no perfect answer here as most of it depends on your environment and if this is a one off application or something that should be ported to other installs (ie. selling a module/giving it away). To try and address what you asked a bit:
  • Session variables are frowned upon, this is because DNN itself is supported in web farms. The core and its provided modules do not use session.
  • I would create a shared 'library' that is referenced by all modules (dnn 5 supports library type extensions, so you can make this installable)
In general, I tend to store user data in a custom table and access it that way. If it is module specific and doesn't require a table, i use module settings (hashtable/dictionary built into the core and available to each module, there is also tabmodulesettings). I also tend to use cache to store collections of data. This can easily be accessed by multiple modules without a dependency, just need to look for the proper cachekey (which you would have created when you set it). 

Chris Paterra

Get direct answers to your questions in the Community Exchange.
 
New Post
7/6/2010 11:34 AM
 
Thanks for the reply.
The environment is a subscription based service that will be hosted on the web. There is a possibility that the app may be sold to an individual entity down the road but would then also be installed on a dedicated machine.

I can understand that a shared library could be used to track "Application Wide" type variables such as PortalID, actual address to specific pages on the server, last updated time stamps for tables and such but not for user specific information. 

Wouldn't module settings be confined to the specific module? I have modules that communicate with each other can those settings be accessed then?

When you speak of Cache, when does that get destroyed? how easy is it to access this in code?
 
Previous
 
Next
HomeHomeDevelopment and...Development and...Getting StartedGetting StartedWhats the proper procedure for variable storageWhats the proper procedure for variable storage


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