In my organization we have multiple environments (Dev, QA, Stage, Prod, Disaster Recovery) and I would like my app/web.config files to contain no environment specific details in URIs, connections strings, etc. My preferred approach would be to perform run-time substitution, e.g. Instead of this:
<endpoint address="http://MyDevWebServer/SomeService" binding="basicHttpBinding"...
I'd prefer to have something like this:
<endpoint address="http://{Env:WebServerName}/SomeService" binding="basicHttpBinding"...
This is simple for config settings read from classes I have control over (just provide a wrapper that performs substitutes {Env:WebServerName} with the actual server name for that environment) but I also want this substitution to take place when settings are being read from classes I have no control over (e.g. WCF, NHibernate etc.). Does anyone know of a way of injecting this kind of substitution logic. I'm assuming an AOP approach might be possible but don't personally have much experience with AOP frameworks.