SignalR-Core-SqlTableDependency
SignalR-Core-SqlTableDependency copied to clipboard
Couple thoughts
I understand the need of EF factory, but is it really neccessary in Core version? Isn’t simpler to use built in scope factory and default EF core scope lifetime. So every time the shorter than request (or longer) is required use:
using(var scope = scopeFactory.CreateScope())
{
var context = scope.ServiceProvider.GetRequiredService<DbContext>();
}
This should result with exactly the same purpose, but will allow greater flexibility with sharing context between different repositories for transactions.
Another thing is related about finalizer inside subscription code. You should never use it unless there are unmanaged resources. Here is great article about this: https://ericlippert.com/2015/05/18/when-everything-you-know-is-wrong-part-one/
Third one: why scoped IHubContext
. Why scoped. As far as I know it is by default singleton. So why to change it?