The best for you in this particular situation only you can say.
The app.config
is used for general settings of how the application works. Normally it should not be used to configure specific operation. It is not always easy to determine what is one and what is another. Understand that it was not made to have frequent changes.
If you have a database I think most settings should be in it.
As far as I understand this information is very specific and are only useful if the database is available. I’ve done several systems like this and never even considered not putting in the database.
I can’t imagine in this case why put this in the configuration file. You might even need to do something just in the database, and without them in it, it would be difficult to accomplish. This information is domain specific and not application as a whole. It is a mistake to put in app.config
.
Overall
What to put in the configuration outside the database:
- what tells how to access the database directly or indirectly, which for obvious reasons can not be within itself (can be network information)
- information that other applications or the execution environment need to access at some point
- other situations that can give a good justification for there.
In the database you have this information more "protected". And you have more resources, even for audit and versioning.
In some cases if you do not want to put it in the database, you need to think about whether it is not the case to use a separate configuration file. I find it rare to need something like this.
Of course, if you use a library that requires setting there, you have no choice but to switch libraries :)
If the application does not have a database, of course this solution is not ideal.
There are those who use Sqlite as configuration file. If it is only for this, unless the configuration is too complex, I do not think it is feasible. But if the Sqlite is already there for some reason, then it might be a good put in it.
If you only have the database on another machine it is possible that you wanted to use the same disconnected application. There is reason to use a configuration file. Or a local database like Sqlite, if you already use it for something else.
On the other hand if you want that user to have its settings preserved on all machines that you will use, putting the settings in a centralized database is the only option, although there may be a hybrid way to meet the disconnected cases.
It’s easier to do it right in the database.
The basic rule is to use the database, and only choose another way if you have a good reason to do so. But there should only be settings that are only needed when the database is available.
For this type of case, use in the database, for example, if you change the machine for some reason.. the data will be saved in the database.. and not on the computer, except on the computer only things needed locally, such as connection settings with the server, (IP, port)...
– Marco Giovanni
I understand, but let’s imagine an application that runs on a server...
– Thomas Erich Pimentel
In this case, I’ve used the
app.config
, today no longer use, usually create a configuration class and serializo it, because I have more control for example, some case I’ve passed, serialize fountain and color– Marco Giovanni