I've got a basic asp.net MVC project that has a Web project, a Service dll project and a Data dll project. I started to store config values in the web project's applicaiton settings but I've come across a few instances where I need them in the service layer. The only way I can think of sharing the values is to pass them to the service layer via parameters. Is there any other way of having one config value that is accessible to all projects?
I tend to keep config tied to the outermost layer (where it is defined in app.config or web.config) and have that layer explicitly pass through any values which are needed for domain or infrastructure logic, which should be what your lower level layers contain.
I find the notion of having config values contained in the outer layer which are 'magically' used by lower level layers to be rather non-intuitive and opaque.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With