Forum Discussion
Prem Shah
Nov 18, 2021Copper Contributor
Best practice for inject Dependency service in Blazor
I am in process to start develop an ERP Application in Blazor server. I am new in Blazor technology. I want suggestion in DI. I have a class called Setting. This class is used for store application’...
AgaveJoe
Nov 18, 2021Copper Contributor
Settings that are tied to login are usually handled by the login provider and returned as user claims and persisted on the client in a token. The service lifetime for a service that reads the user claims would be a singleton in Blazor WASM.
I recommend visiting the Blazor authentication and authorization documentation for ideas.
https://docs.microsoft.com/en-us/aspnet/core/blazor/security/?view=aspnetcore-6.0