Open utterances-bot opened 5 years ago
You need a like button :)
Good article -- thanks.
Nice article, but why do I need .NET Core 3? All the shown code works also with .NET4 and later, right?
@chadbr Thank you. I appreciate every feedback - it helps me to stay motivated and delivering more high quality content. Maybe I will add such "like" or "up-vote" functionality 👍
@pepperpark You couldn't use the AssemblyLoadContext in any .NET Framework version - It is only available in .NET Core Framework (1.0 - 3.0). The "unloading feature" of the assembly load context, is only supported from version 3.0 and higher.
Nice article. I am working on something similar using worker Service template and have problem how to pass arguments to plugin constructor. Concretely I want to pass ILogger and DbContext to plugin constructor using DI. Can you extend your example for this case (passing ILogger from main program to plugin)?
@nas963 Thanks for your feedback. Good question, sure it is possible to do this - my code is simplified to ensure that also beginner will hopefully understand it. There is already a more advanced library out there that solves this: natemcmaster/DotNetCorePlugins. Thanks @natemcmaster 👍
When you say var pluginFinderAssemblyContext = new PluginAssemblyLoadingContext(name: "PluginFinderAssemblyContext");
What is PluginAssemblyLoadingContext? Did you mean AssemblyLoadContext? Also what is and where is PluginBase?
This article can be truly very useful if you help with the missing pieces.
Also what's in the RegisterPlugin? Can you please add that?
@MithunChopda Hello! I don't know if this is still relevant to you after all this time, but I'm also learning how to work with plugins.
Obviously, PluginAssemblyLoadingContext is a standard AssemblyLoadContext class. PluginBase is just a base class with a Name field. RegisterPlugin - DI registration method. Thx!
A plugin system with .NET Core
undefined
https://codetherapist.github.io//blog/netcore3-plugin-system/