Intro:
- Normally we store
ConnectionStrings
and some other settings (<appSettings> <add key...
) in theWeb.config
orApp.config
.
My scenery:
Web application using factory pattern with direct injection to read data providers.
In the
web.config
I have the key that tells me which DLL (provider) will I use to retrieve my data.I can have more than one provider (each DLL will be a provider for MS SQL, MySQL, or get the data from some SOA service).
Each DLL has his own name (ID and namespaces) and will need to have is own configurations (dataconnections, service urls, etc...) , the first idea is to write then in the
app.config
.
Problems:
#1 - The website is running (runtime) I need to change the Data Provider, how can I do this? Somehow the default value written in the
Web.config
will be changed.- My objective is to be able to have multiple providers (and during runtime: add/delete providers and change configurations) - this leads me to my second problem:
.
#2 - Each Data Provider has custom configurations and App.Config files do not work with dll assemblies, only executables. This means that I need to write then on my Web.Config (I do not like this option, because once again I am updating my web.config in runtime). how can I solve this?
- I am trying to avoid to write a custom settings XML file. My ideal solution is to deploy somehow the
DLL
andDLL.config
per each provider. And once again during runtime I may need to change this configuration values.
- I am trying to avoid to write a custom settings XML file. My ideal solution is to deploy somehow the
.