I can't share my code. It's huge and specific to my work. So let me flip the question. Can you provide a sample component and how it should be done? A blazor component, with some kind of click handler, that needs to use some services, do its work, and NOT lock/block. What gets injected? What gets inherited? What attributes, if any, do you use (e.g. in the clck handler in blazor do you add [UnitOfwork])? I'm just looking for best practices patterns. I wasn't able to find anything concrete about it.
I'm pretty sure I tried this, but I'll try again. I'm using AppServices heavily, but I found that if I had two pages open: one that created an object and the other that listed objects of that type, the page that listed the objects did NOT get the new item until AFTER I refreshed the first screen, meaning it was still holding on to a DB transaction. To get around it I create a new scope and then resolve my app service from there. I guess that's because I'm injecting my AppService into the blazor component and that app service is in ONE Unit Of Work -- not each method call to my App Service. That's where it's getting stuck.
I can try to decorate my blazor componetns with UnitOfWork and see if that helps create a new scope, so even if my parent AppService is long lived then each Blazor handler method will be a short-lived circuit on it. That feels fragile though.
I am using Blazor COMPONENTS mixed in with my .NET MVC app. I'm slowly porting over away from MVC and into full blazor. The problem I have is, because we have a persistent blazor server connection, it's a long-standing "request" which means it holds on to DB connections. IF a transaction is in flight, until the Blazor server connection is severed, the DB is locked to other pages! I'm currently getting around it by creating a new scope on every request and not injecting any services into my blazor component and instead resolving them at runtime in each method handler. Is that really the only solution? Or is there some way to set this up that it works properly with Blazor server?
I've searched around and haven't been able to find anything in the documentation that might point me in the right direction.