Resources / App.config or Database, where is the best place for application strings

Everything,

I am currently looking at an old application that I support, and it uses a mixture of extracting application configuration settings from the App.config configuration table and the application in the database.

In the new software that I am working on (the port of the old application), I have a list of email addresses that are static and rarely change, which would be the best mechanism to receive them. I am currently using resource strings, so using them is a simple My.Resources. But what are the advantages / disadvantages of storing information in either the App.Config table or the database table.

At what point does it make no sense to use resources?

+4
source share
3 answers

Does it all depend? Some of my rules of thumb are:

to go to the configuration / resource file

  • it is the same for each user, for example, the path to the image directory
  • data is needed only at the user interface level and will not change very often, like a list of American states.
  • it can vary from server to server, as a resource URL for production and testing

to go to DB

  • It changes for each user or is user data.
  • You may need to be supported by one of the parties in your development team.
  • It will be used outside the user interface level.
  • It will be updated regularly.

what are you doing

THE CODE PAGE IS NOT REQUIRED IN YOUR CODE, I don’t care how confident you are that the error message tells you that the email address will not change, THIS IS NOT A DIFFICULT CODE !!!! or 3 years after the road, which would be a 2-second configuration change, it will lead to 2 weeks of work to get the worked out obsolete part of the shitty compilation application !! or another funny one was an xml scheme hardcoded into an application with

stringname += "Schema data"; stringname += "Schema data"; stringname += "Schema data"; 

Oddly enough the same guy, go figure.

+2
source

I think that rarely changing settings can safely go to app.config. It was pretty transparent when they appeared for new developers on the team, and yet you can change the settings without recompiling.

For things that change frequently and regularly, I will use either a database, a settings file in the user profile, or another shared location, etc. Something that will make it easier to manage configuration changes.

On the other hand, I do not think that the resource file should be used to store the configuration, but rather to centralize (and in some cases save translations, etc.) all hard-coded materials in your application. I would be very surprised if I inherited your code.

+1
source

I want to set a minimum size in configuration files. It is enough to connect to your database or what you use as a data source. This is less information that is located somewhere in a flat file. For storing emails, I would put this in the database.

0
source

All Articles