Quantcast
Channel: Active questions tagged blazor - Stack Overflow
Viewing all articles
Browse latest Browse all 4839

Migrating code from desktop to blazor: how to handle static state

$
0
0

We are currently looking at Blazor for migrating a large desktop code base. We have been using asp.net core and Blazor for other projects for years, so we know how it works. The new situation is challenging because we cannot start from scratch. We have a code base of considerable size that we need to migrate.

When using the application to be ported, the user can select among a number of databases which one to connect to. Every single piece of code that accesses the database needs to know which one the user selected. There are many many such pieces of code in the legacy code base.

Therefore, in the legacy desktop application, information about the selected database is stored inside a static variable, and every piece of code can just look there and that's it.

What would be the correct way to achieve this using Blazor? We are at the point right now, where it seems that we have to pass this information through each and every object and method call. This cannot be the right way.

It would be neat if we could find some statically available information that correlates with the circuit under which the current code executes. With that information, we could reuse the legacy code with only minor changes. We tried using the TraceIdentifier, CircuitId, but we did not find a way to access this information reliably from code that is outside the blazor dependency injection ecosystem.

Is there anyone out there that faced similar issues, and how did you resolve them?

Thanks!


Viewing all articles
Browse latest Browse all 4839

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>