Switching over from coupling the DbContext with the service to a repository pattern meant creating a scoped database-context. This is typically not a good idea for Blazor web applications, because the DbContext will not be disposed of until the session (circuit) is terminated. This will effectively hold the DbContext connection hostage until the user leaves.
The service can be made to be transient and easily disposable, or the data provider can be made more readily disposable by using a factory. There are ramifications to either option.
Switching over from coupling the DbContext with the service to a repository pattern meant creating a scoped database-context. This is typically not a good idea for Blazor web applications, because the DbContext will not be disposed of until the session (circuit) is terminated. This will effectively hold the DbContext connection hostage until the user leaves.
The service can be made to be transient and easily disposable, or the data provider can be made more readily disposable by using a factory. There are ramifications to either option.