DBContext disposing doesn't change the number of opened connections

asked7 years ago
last updated7 years ago
viewed175 times
Up Vote3Down Vote

In highload legacy application I've found tons of code which just creates new DBContext, then makes request and doesn't dispose the DBContext at all.

Monitoring shows 200 connections opened all the time and disposing all DBContext doesn't resolve this issue.

Connection pooling is by default. Database: MariaDB. If it's important, this is servicestack

Could you please share ideas on how to resolve this: decrease the level of opened connection so that the number of opened connection would correlate with the REAL number of connection from DBContext.

Also I've looked through the following links:

DbContext disposing?

EF DBContext dispose not closing the connection

Not Using Dispose or Using() in Entity Framework

Should i use Pooling=False in Entity Framework Connection String?

Entity Framework and Connection Pooling