© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
C#C
C#•3y ago•
7 replies
Exi

❔ BlazorWASM Multi-Tenant Application - Struggle with changing DbContext while Runtime

Hey,
I have created a Blazor WebAssembly (WASM) application, and I would like to select the DatabaseConnection in the user interface, for example, using a Select/Dropdown, and accordingly update the context for this session/user for further queries. However, I am currently facing the issue that the context is not getting updated, and (I suspect) the subsequent functions are called with the initial DbContext of the application during their initialization.

I would appreciate it if someone could help me with this. (I am relatively new to C#/.NET, advice on code is also welcome.)

In the attachments you see the most important parts of the code (I hope). If you need anything else, just ask and I'll provide you with more information.

Attached Files:
Service with function to change context
Service Implementation / Registration
Example use of my dbcontext in my repo for db calls

Thanks and I hope someone is willing to help! :)
I'd love to learn from you.

Greatings Exi
image.png
image.png
image.png
image.png
C# banner
C#Join
We are a programming server aimed at coders discussing everything related to C# (CSharp) and .NET.
61,871Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

✅ BlazorWASM Multi Tenant / Multi Tenancy
C#CC# / help
3y ago
✅ DbContext lock up application
C#CC# / help
3mo ago
❔ Multi-tenant == Roles ?
C#CC# / help
4y ago
Error while using DBContext
C#CC# / help
3y ago