natemcmaster / DotNetCorePlugins

.NET Core library for dynamically loading code

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[Question] Calling host from plugin and calling plugin from plugin?

lonnietc opened this issue · comments

Hello,

I have been trying to get a feel for the DotNetCorePlugins library and although there are some examples of Host --> Plugin method calling, I also need to try and locate some documentation or examples on:

  1. Plugin --> Host method calling
  2. Plugin --> Plugin method calling

Are there any examples for documentation for these with special interest in (1) above?

Cross-plugin calling is harding to get right, but can be done. I don't have any samples as I haven't built any apps that do this myself. I think the primary problem you will have with direct plugin-to-plugin calls is that you still need a way to have type unification work. That usually means you need a common shared type in the host. I recommend looking at https://github.com/natemcmaster/DotNetCorePlugins/tree/main/samples/dynamic-implementation as a baseline for structuring apps that need to manage complex dependencies.

For Plugin --> Plugin, you can use dynamic to access method/properties