How to dynamically download and render assembly in a Blazor WASM project?

Viewed 716

In my current ASP .Net Core 3.x project using Razor Pages there is a "Reports" page. Each report is a separate assembly on a server. When activated, the client downloads the report's markup (HTML + JS + CSS) through API and renders it dynamically on a page. This works perfectly and makes each report to have it's unique UI with specific validation rules, external requests, etc., since custom JS is used.

Now I'm planning to make a new project using Blazor with the same functionality but this time without JS. Only pure C#.

The only way to render this kind of dynamic content that I've found is through manual RenderTreeBuilder logic. But it seems to be very low-level for this task and that sign saying "These types should be considered unstable and subject to change in future releases" makes me a bit nervous.

So the idea is to dynamically download the entire assembly for the report (or a .zip containing multiple assemblies if needed) and render it's UI with all the logic behind it. It seems that assembly lazy loading could be used for this task, but I'm not entirely sure how to use it for dynamic assembly resolution.

The issue is that this feature requires static information for assemblies that are marked as "lazy" which is not available to me, since reports are separate "plugins" in a server folder. Also it seems that ASP .Net Core hosted solution is also required and my plan was to use static hosting.

In the end I wanted to have a static Blazor SPA, hosted behind any type of a web server (NGINX, Apache, etc.) which requests reports from a API server and renders their UI dynamically with all the logic written in C#.

Any ideas where to start? My thoughts are to go with lazy loading, but not sure how to use that feature for the task.

0 Answers
Related