R – Configuration strategy for multiple modules

configurationnet

Are there different strategies for configuration when you have multiple modules in the same application? I have an application that uses a CommonLib library which is maintained by some other in-house group, then we are using some 3rd party tools as well that need to be configured. Everything seems to depend on configuration settings being put into the app.config but I can't help thinking that there might come a time where there will be conflicts .. e.g. our CommonLib uses a "username" setting that is being fetched from the element.

Can anyone comment on how this should be done properly?

Should everything be bundled up in one configuration file or could each module have its own configuration file somehow? How would something like that be implemented?

Best Answer

If you are doing this kind of development, you're going to want to use your own System.Configuration.ConfigurationSection - based type instead of just throwing everything into the appSettings key of your XML file. That goes for your vendors too. "appSettings" should only be for application-specific settings, and not for configuring your libraries.