❔ 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
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



