As far as I am aware, there is no public document on the internet which describes this approach in a consolidated way. Unfortunately, I cannot share examples from the codebase I am currently operating on. That said, I can offer some MS documentation links in hopes that this paints a slightly better picture for how I achieve this outcome.
This describes how you would request a scoped stateful service from an arbitrary Razor Component:
Note that we are using Server-Side Blazor, so this approach works for us. I do not think it works with WASM (at least out of the box), but we do not care for this form of Blazor hosting right now, so its not a concern for us.
This describes how you would request a scoped stateful service from an arbitrary Razor Component:
https://docs.microsoft.com/en-us/aspnet/core/blazor/fundamen...
This describes how you would inject these stateful services into DI in a way that scopes them as desired:
https://docs.microsoft.com/en-us/aspnet/core/blazor/fundamen...
Note that we are using Server-Side Blazor, so this approach works for us. I do not think it works with WASM (at least out of the box), but we do not care for this form of Blazor hosting right now, so its not a concern for us.