Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Configuration settings in (web.config|app.config) versus a Static Class Object

I am just looking at the source code of BlogEngine.Net and was intrigued at how it stores application settings.

Instead of using web.config or app.config which I am accustomed to, the source uses a static class object implemented using a singleton pattern to achieve the application settings. the information is still stored in a settings file but any calls to retrieve information is done via the class object which preloaded all information into property values.

Any advantages of different approaches?

like image 484
TimLeung Avatar asked Dec 13 '25 22:12

TimLeung


1 Answers

If you have an admin area where you can alter the configuration settings, writing to web.config will cause the app to be restarted and all users to lose their session data. Using a separate config file will prevent this from happening.

like image 80
Adam Pope Avatar answered Dec 15 '25 15:12

Adam Pope



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!