Solution multi assemblies


I have a solution having multiple projects each containing visual and non-visual plugins. For factorization reasons, I would like these plugins to be able to share certain resources, in particular a chromium engine.
Currently, we load each controller module in each assembly separately, which has the effect of creating a chromium engine for each assembly.
Would there be a best practice for doing this kind of exercise, I tried to create a single modulecontroler in an assembly that references all the others, but I get an error when I try to load a plugin , which it cannot find in my assembly containing the controler since it is in an external assembly.

Off the top of my head (Im not the Hydra expert ;), unless you load each plugin module into its own app domain, then should share the same space (the one app domain), and any shared/common assemblies used by more than one plugin will only be loaded once, and instances (such as a Chromium engine) can also be shared among all plugins…

Currently, I am creating a delphi modulecontroler for each assembly, so when I load each assembly I feel like each has its own domain.

This could happen because .NET runtime loads referenced assemblies lazily. To force assembly loading you can add following code to your ModuleController constructor:

         // Added fields
        private Type _pluginType1;
		public ModuleController()
            // Added code
            this._pluginType = typeof(<<your plugin type>>);

This code doesn’t do anything meaningful. Instead it forces .NET to load assembly containing plugin type. This should allow Hydra to instantiate plugin.

Hope that helps

Thanks for the reply, but it doesn’t work, I tried and it keeps telling me that he doesn’t know the plugin.

It seems that this approach will require significant update to the managed plugin loading procedure. I have logged the issue to review and implement this change.

1 Like