Reputation: 1156
I have been given the task to write a technical specification (and later implement) a system that will be build on a few sub-modules. The sub-modules will be developed partly in parallel so I would really like to avoid restarting the whole system each time a plugin is added or updated. Since I have already used Simple Injector in another project I plan to use it for IoC in each sub-module. Instead of introducing MEF (Managed Extensibility Framework) or MAF (Managed AddIn Framework) in the core binding the modules together, my plan is to see if Simple Injector can be used for handling the modules as well.
My plan is to use a FileSystemWatcher to watch a plugin directory and when a change is detected either have Simple Injector do it's thing or perhaps roll my own solution. I have read the discussion here but I believe my use case is different.
Requirements:
To be able to dynamically load/reload assemblies I plan on running each module in a separate AppDomain.
Is this possible using Simple Injector? Any other thoughts? Perhaps something I haven't thought about.
Upvotes: 1
Views: 347
Reputation: 1156
So, based on the correspondence with Steven I decided to look at alternatives and talk to my CTO. This resulted in a completely different architecture (microservices - probably implemented as Azure Functions) communicating through a message bus (Azure Service Bus). This complies with all the requirements and (using Azure Functions) ensures that we only pay for computing power when events arises that should be handled.
Upvotes: 0
Reputation: 172606
This is not something that DI Containers facilitate. They just compose object graphs. Seems to me you need to run isolated processes or app domains (otherwise it would be impossible to reload them).
This means that the DI Container will run inside that isolated domain (i.e. your module) a d within that module, you would use your container as you would always use it. This wouldn't be different with Simple Injector.
Upvotes: 1