Alex Rivera | Logout

Which configuration method do you prefer in .net? Why?

Asked 2008-09-22T20:27:48.573
18
  • You can use App.config; but it only supports key/value pairs.
  • You can use .Net configuration, configuration sections; but it can be really complex.
  • You can use Xml Serialization/Deserialization by yourself; your classes-your way.
  • You can use some other method; what can they be? ...

Which of these or other methods (if there are) do you prefer? Why?

Edit
Report

3 Answers

4

Put your configuration into a database. If you run your app on more than 1 machine (eg a client-server app) then all the per-machine config systems are a PITA. A single config area is the best way to place your configuration. Write a gui to manage it and you'll be very happy.

Rolling out app.config files to 200 client boxes.. its not fun, especially when one gets missed (and they do, believe me).

answered 2008-09-22T21:06:37.233
1

I use a custom xml configuration file, where a different config file is used for each environment (dev/qa/prod). The config files are templates that are dynamically instantiated with things like host/port configurations for services - this makes multi environments and failover very easy as it can be handled by the template instantiation code.

Of course if you have very little config and are not concerned with multiple environments then app.config is more standard and is probably the best way to go.

answered 2008-09-22T20:33:19.030
0

Mostly I prefer using custom xml file and Xml Serialization method to read and write this config files... Not restricted to key/value pairs and not complex to implement...

answered 2008-09-23T08:36:18.230

Your Answer