In my current solution I have 18 projects and most of them have their own configuration files (app.config or web.config). Each project uses single shared BLL assembly. I'm using Autofac to handle dependencies but haven't come with a decent way of managing my configuration. Configuration entries are roughly the same, but values are different. Some projects use custom config secions and some are not.
I ended up with:
- Create single autofac bootstrapper class to register all dependencies except configuration file wrappers.
- Create separate assembly (referenced by all projects) with IConfiguration interface.
- Create each project's own implementation of IConfiguration.
- Bootstrap dependencies in each project's appropriate place via shared bootstrapper.
- Register project's own IConfiguration implenentation separately after bootstrap registration.
I'm very new to Autofac and DI in general and striving to find a good balance between complexity and extensibility.
Are there better ways to manage configuration files?
Thank you.