Blazor WASM Lazy Loaded Assemblies and DI registration.

Brian Wilkinson 16 Reputation points
2020-12-02T22:02:09.693+00:00

I'm exploring BLAZOR WASM as a potential replacement to our LOB silverlight App. One of our requirements is to lazy load business capability libraries based on user role, and when the user want to go into that business capability. Currently we use MEF and the UnityContainer, and this meets our needs well.
What I looking to do is register the Services and Components from the Lazy Loaded assemblies once they are loaded, so that they can be used with the DI Framework within BLAZOR WASM, and resolved in the usual way.

Because the DI framework is configured as below :-

....
builder.Services.AddSingleton<IRequiredEntitySelector, RequiredEntitySelector>(); // Register Service with DI.
.....
.....

and then

WebAssemblyHost assemblyHost = builder.Build();
await assemblyHost.RunAsync();

How can I register services after RunAsync has been called.

Blazor
Blazor
A free and open-source web framework that enables developers to create web apps using C# and HTML being developed by Microsoft.
1,458 questions
0 comments No comments
{count} votes