trymodular icon indicating copy to clipboard operation
trymodular copied to clipboard

2 application parts with same controller (name) and runtime choosing 1 of them

Open softyn opened this issue 9 years ago • 2 comments

Hi, I have 2 similar controllers as application parts in different dlls. I would like to have ability to choose at runtime which of them to use. Is it possible? Currently I can register one of them at startup and later use it. The problem is to replace that registred at startup dll with another one (so without restarting app). I can load another dll, but the fist one gets somehow cached (?) and removing at runtime from builder.PartManager.ApplicationParts and replacing with new one builder.AddApplicationPart(newAssembly).AddControllersAsServices() does not work for me. (BTW. builder=services.AddMvc(); - from ConfigureServices stored in startup classs variable for futher usage).

Have you try such runtime Reaload scenario or have any ideas how to do it?

softyn avatar Jul 22 '16 10:07 softyn

Hi @softyn I haven't try this. If you get any result please share us. Thanks

thiennn avatar Jul 25 '16 02:07 thiennn

You can't do this, the first doesn't get cached, it remains loaded in memory. You can reload the DLL which will cause the signatures to update but the DLL is not unloaded from memory. You can unload DLL's in ASP.NET using AppDomains but they are not supported in ASP.NET Core.

PonchoPowers avatar Jul 18 '18 22:07 PonchoPowers