ModuleManger, why no "UnloadModule(...)"? #2564
-
I am new to both PRISM and Unity, this is just a basic conceptual question. It looks like Modules are intended to be a "plug-in" mechanism. You can create a dll and then load it, on demand, any time after your application has started and even after it has been running for a while. In the docs it shows how I can configure a Module to be "OnDemand", for example...
Once a module has been added as OnDemand to the ModuleCatalog, it can actually be loaded through the ModuleManager like this Inside the Module class definition you may override a "RegisterTypes" method which gives you access to the DI Container Registry...
In the examples, I see how Modules can hold Views and ViewModels. That's cool, but I would like to have some business logic in the Modules as well. In particular, I got a Factory Service and I would like have a Module add an implementation to this Factory Service in it's RegisterTypes override. Can I do that? It seems that I can. The next question is, since I "loaded" the Module, how come there's no way to "unload" the Module? The fact that I can't find a way to unload a module and that makes me think I am misunderstanding the intention of Modules. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
The answer to your question is yes, you can put custom logic in modules and register your factories with the container. In the case of WPF, loading a module is the process of adding an assembly (DLL) into the app domain at runtime. You cannot remove a DLL from an app domain once loaded. |
Beta Was this translation helpful? Give feedback.
The answer to your question is yes, you can put custom logic in modules and register your factories with the container.
In the case of WPF, loading a module is the process of adding an assembly (DLL) into the app domain at runtime. You cannot remove a DLL from an app domain once loaded.