Net Core 3.1 - ApplicationBootstrapper and ServiceProviderWrapper
Closed this issue · 2 comments
Aurelio67 commented
Hi Mauro, now I always have a problem during the boot phase with the ServiceProviderWrapper class that was in the Radical.Windows.Presentation.CastleWindsor.dll,
in practice I use it to inject the modules into the main application if present, obviously this dll is not there now, how can I address the problem?
//Quando il boot è completato, trovo tutti i moduli che implementano l'interfaccia IPluginDefinition come service
//li ordino per Name ed eseguo l'action Initialize()
.OnBootCompleted(serviceProvider =>
{
((ServiceProviderWrapper)serviceProvider)
.Container
.ResolveAll<IPluginDefinition>()
.OrderBy(o => o.Name)
.ForEach(r => r.Initialize());
});
This thing was cool because I only gave the client the module dlls that interested him (as you taught me :))
Many Thanks
mauroservienti commented
Hi @Aurelio67. ServiceProviderWrapper
is not anymore needed as the new Microsoft Dependency Injection infrastructure replaces it. You can change your code as follows:
var bootstrapper = new ApplicationBootstrapper<Presentation.MainView>()
.OnBootCompleted(serviceProvider =>
{
serviceProvider.GetServices<IPluginDefinition>()
.OrderBy(plugin => plugin.Name)
.ForEach(plugin => plugin.Initialize());
});
Aurelio67 commented
Hi Mauro, all work OK, boot phase converted completely
Many Thanks