We fight the issue in production when once in a while our Azure SQL database performance significantly degrades. We know we have locks on one of the tables, but these locks are
There are 2 things you can check on you dbcontext objects to see if you are using them correctly and dispose object to return the connection to the connection pool.
First, you are creating the dbcontext from code. Check if there is a using statement around each creation scope of the dbcontext object. Something like:
using (var context = new xxxContext()) {
...
}
This will dispose the context when it goes out of scope automatically.
Second you are using dependency injection to inject the dbcontext object. Make sure you are using scoped:
services.AddScoped(
Then the DI will take care of disposing your context objects.
The next thing you can check is if you have uncommitted transactions. Check if all you transactions are within using blocks, so they will commit or rollback when you are out of scope.