Use ini / appconfig file or sql server file to store custom config?

I know the preference for INI or appconfig XML is their readability.

Suppose the custom settings saved for my application are hierarchical with about a thousand items, and it would really confuse the user to change the INI to change everything.

I've always used a combination of INI with appconfig.

I am now leaning towards using a SQL server db file. Every time the user changes preference while using the app, it will be stored in the db file - that's my thought. I also think that such a db config file can move along with the application, just like INI.

Before I do that, any advice 1. If there are any disadvantages against using the db file via INI or appconfig.
2. If the store uses mysql or oracle, do you think your colleagues will raise the question of why you are using sql server technology in the mysql or oracle store? I mean, I just use it as an INI file or app.config anyway, right?

Additional information :
I hope that people reading my question will understand that I am not using the "corporate database" but the "preferences.mdf" stored with the application. In this I hope to use ado.net to store custom config items as objects.

+2


a source to share


3 answers


My general approach is to put the custom configuration records in a database (centralized in our case, but equally applicable as local storage).

However, there are exceptions to this and I keep the following in a text file (usually app.config):

  • Details on how to connect to the database (I prefer to have this in the config file rather than using a convention).
  • Any setting that could potentially stop the application from starting.


If there are settings that can "break" the launch, the user should be able to access them without using software - it is best to use a text store.

In the code, I write one configuration class that "knows" whether the configuration record is saved in a text file or in a database; this allows me to move configuration from one to the other without breaking any links.

Herbie

+2


a source


It really depends on the architecture of your application.

For example, if you are building a web application, you will want to store the custom settings in the database, since the entire user / role system will be stored in the database anyway.

If this is just a simple desktop application used on separate machines with no interaction between copies of the software, you can use an XML file to store the settings - using a database can be overwhelming, especially if you are not using the database for anything else.



Of course, there are advantages and disadvantages to both methods. If you are using a database, this means that there are many more configuration steps in the deployment (again, depending on your architecture), and a simple configuration file is lighter and easier to move around.

One note, if you go the database route, you still need to use a config file to store the information needed to connect to the database.

+4


a source


I often store my custom settings in a centralized database, as this means that custom settings can be "moved" from PC to PC.

Another plus is that user settings are backed up.

+3


a source







All Articles