Category - Projects

AppSettings

When the registration was in PHP, I had several "setting" variables stored in the database that I would use database calls to retrieve the values. Initially, this was a great solution, however, after going through Centriq I learned that this was resulting in a lot of unnecessary sql queries.

In this version I toyed around with utilizing the web.config and setting up AppSettings. I even went so far as to create an interface that would make changes to the web.config's AppSettings, through code like this:

 Configuration configFile = WebConfigurationManager.OpenWebConfiguration("~"); 
AppSettingsSection AppSection = configFile.GetSection("appSettings") as AppSettingsSection; 
AppSection.Settings.Remove("EventID"); 
AppSection.Settings.Add(new KeyValueConfigurationElement( "EventID", gvEvents.SelectedValue.ToString())); 

Of course, using the interface did require a site rebuild, however, these settings were ones that were changed once a year. So, at the time, this was a viable option, though obviously not the optimal solution yet.

You must be logged in to comment.