I would appreciate a recommendation on what approach best fits with AutoFac.
I'm building a platform (user
ASP.NET) that supports pluggable "apps." I'm using AutoFac extensively for global and per-request scoped services. Now I need to allow my plugged in apps to register components/services but I'm not sure how to do that. Here's the challenge:
One of the current services is the singleton AppManager service which is responsible for loading each app and getting it started up. The challenge is this: the AppManager of course has various dependencies that it needs injected in so the app manager can't be instantiated in order to load apps until Build() has already been run on the IContainer. Only then can each app be given a chance to register its services. But by then the container has been built.
I've seen that there is an Update() method for the container but there are strong reasons listed why using that should be avoided. Because I have confidence that the app-based registration will happen early in the startup of the whole platform maybe these cautions can be ignored (?), but I'm wondering if there is some better way.
How would you approach this in a way most consistent with best practices for AutoFac?
David