EF Core是否有连接池? [英] Does EF Core have a connection pool?
本文介绍了EF Core是否有连接池?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
EF Core的 DbContext
在ASP.NET Core服务中。因此,将在每个请求上创建一个新的 DbContext
。这是否意味着每个请求都会打开一个新连接,包括登录数据库等所有开销?还是有一个独立于 DbContext
的连接池?
The DbContext
of EF Core is scoped in the ASP.NET Core services. So a new DbContext
is created on each request. Does this mean that a new connection is opened on each request, including all the overhead like logging in to the database? Or is there a connection pool that is independent of the DbContext
?
推荐答案
诸如System.Data.SqlClient之类的基础ADO.NET提供程序通常实现一个连接池
The underlying ADO.NET provider like System.Data.SqlClient usually implements a connection pool
这篇关于EF Core是否有连接池?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文