merken / Prise

A .NET Plugin Framework.
https://merken.github.io/Prise
MIT License
361 stars 39 forks source link

PluginBootstrapper.Bootstrap event called on each Http Get Request #45

Open avatejo opened 3 years ago

avatejo commented 3 years ago

I'm using Prise in a dotnetCore3.1 windows service, that does plugin discovery in the ApplicationLifetime.ApplicationStarted Event to add new Web Controllers at runtime.

Everything works fine !, I'm able to invoke Web Modules Methods, access Host Configuration using the Proxy, and invoke Services registered by the Bootstrapper of each Controller.

I use an Interface to allow Prise discover the module on the ApplicationStarted Event : IWebModule

Later when perform a Http Get request to any Controller method (I have three controllers and three bootstrapper classes), the Bootstrapper event is called.

But then after continuous request, the Bootstrapper event and all services are been loaded again and again. This seems to me like a performance issue. :(

How can I preserve the scoped ServiceCollection and use the same one over the calls?, there is some singleton services and all other are scoped services.

I would like to: when load the plugin, load the service collection and later be able to access some singleton services inside the Scoped service collection.

I'm developing a Health Check system to monitor the Web Module Status, that is perform getting some data from singleton services running inside the Web Module.

merken commented 3 years ago

Hi,

Nice to hear that it is you've managed to setup Prise.

Sounds like a lifecycle issue to me, would you mind sharing a reproduction example via a GitHub repo?

Kr, M

merken commented 1 year ago

Hi,

I still need a reproduction repo to investigate this.