natemcmaster / DotNetCorePlugins

.NET Core library for dynamically loading code

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[Question] How To Handle Modular Startup Config from Plugins?

aloksharma1 opened this issue · comments

hello all,
please read below scenario:
in a plugin based application where a single host application serves with micro plugins everything is working well and good, but i need to do startup service registration from these plugins as needed so say plugin1 introduces a middleware, plugin2 a pipeline, plugin3 some mediatr service etc... i dig into OrchardCore & Orchard does that by using a StartupBase class but i am unable to find out how they are doing it [if my assumption is correct orchard uses msbuild for plugins unlike loadcontext of this library].

my requirements and structure is different from orchard, but i like the idea of having a StartupBase class
where i can define configuration order and service init order and it gets called on main host app initilization
can someone guide me to the right way to do this, i am ok with even minimal flow steps as long as its clear to understand.
the Plugin Startup files must handle the defined order in host and be injected into main startup bus.

thanks

commented

@aloksharma1
Check the below sample where each plugin project is injecting it's own Configure() and ConfigureServices() at runtime when the host app started...

https://github.com/natemcmaster/DotNetCorePlugins/blob/main/samples/aspnetcore/WebAppPlugin1/WebPlugin1.cs

thanks didnt saw that and went on implementing my own logic... which is similar to this :)