I'm having a problem with socket leaks in Azure....
This is the current way I do DI in my controllers:
private readonly ApplicationDbContext _context; public SomeController(ApplicationDbContext context) {_context = context;}
On of stackoverflow users suggested that I'm doing it wrong and that I should do this:
using (var scope = _scopeFactory.CreateScope()) {var context = scope.ServiceProvider.GetRequiredService<ApplicationDbContext>();}
But Microsoft's tutorials use the way I'm handling it....
Can someone plesae explain what is the difference and which way is better?
http://stackoverflow.com/questions/42104788/azure-socket-leaks
Thanks a lot