Reputation: 1186
I've recently started working on quite a large application and I've noticed that a lot of settings are stored in static classes/properties rather than in the web.config:
public static class FormSettings
{
public const string HttpPostContentType = "application/x-www-form-urlencoded";
public const string HttpPostMethodValue = "POST";
}
The only reason I can see for doing this is due to the large number of settings which would make storing them in a single file unwieldy.
Other than the fact these settings can't be altered without recompiling the code, are there any other disadvantages to this approach?
Edit:
Ok the example above wasn't the best:
public static class ThirdPartyApiSettings
{
public const string EmployeeXmlNodeName = "Employee";
public const string FirstNameXmlNodeName = "FirstName";
}
Upvotes: 0
Views: 145
Reputation: 2075
Storing settings really depends on the application and scenario. With your approach, the biggest problem is that everything is hardcoded. As someone mentioned above, you have to think about :
There are few ways of storing settings :
You might also want to think if you need versioning, auditing and stuff like that.
Hope it helps.
Upvotes: 2
Reputation: 1379
You have more to compile, you have more dependencies and you can't change them without rebuilding the whole application.
Also, it's just not a programming part and should be seperated. You could also put your controller, view, action and dao in one file (in a webapp) and it would work but you just don't do that :)
Upvotes: 0