asp.net - Reading Application Configuration during Application_Start -
Consider a web application that resizes larger TIFF files on the fly, each big TIFF file is a JPG thumbnail and larger JPG is changed into when the user invokes operation. The dimensions of these converted files are always the same.
During the review of the code yesterday, one of the other developers asked me why I set those dimensions at my global level. Such as:
application ["resizedImageWidth"] = int.Parse (Configuration Manager. AppSettings ["ResizedImageWidth"]); , instead of viewing the value only through a configuration file during actual configuration orientation. I store the width in the configuration file, in which the application wants to change the dimension after testing the end user, so I do not need to change the code inline.
The argument I gave was preventing it from reading the configuration file every time an image is generated, but it can not tell whether there was an equal overhead during a lookup for the application level variable. This optimization probably does not affect the performance on a large scale, but I wanted to know what the community was thinking that what was a more efficient solution, i.e. they were started during the application, or when flying during the greeting Read Normally you should read from the configuration on the fly as you would need it to cache the configuration file that is needed,
That's why it is quite executable. And believe me (do not quote me) that ASP .Net can monitor the changes in the configuration file without restarting the application.
I usually want to create configuration class which will hide the details, the value is stable:
public static class configuration {public static inteximmment () {...} } This keeps your calling code clean with the configuration code, and if you think I am wrong, then your code will not be changed everywhere.
Comments
Post a Comment