With lots of great feedback I’ve modified the “SiteGlobalSettings” class I wrote about earlier.

Though it still uses global static but the values are stored in a Global Resource File.

This affords us the superior performance of the mechanism, keeps the “editable” nature of the data, and keeps the simple API based initialization will facilitate multi-cultural implementation when we get there. (Cultural neutral settings can be stored in a single .resx where as language specific entries can be stored in language specific resource files.)

So, I created a Resource file and a sample entry…..

7-9-2009 10-21-23 AM 

7-9-2009 10-22-05 AM

The class code remains the same except for the property initialization.

   1:  public static class SiteGlobalSettings
   2:  {
   3:      static public string MySiteName { get; set; }
   4:      static public string MySiteOwner { get; set; }
   5:   
   6:      static SiteGlobalSettings()
   7:      {
   8:          try
   9:          {
  10:          MySiteName = (String)HttpContext.GetGlobalResourceObject("AppResources",
  11:                                                                    "SiteName");
  12:          }
  13:          catch
  14:          {
  15:              MySiteName = "*NETOOP.";
  16:          }
  17:      }
  18:  }

Technorati Tags: ,ASP.NETOOP,