我应该在实体框架连接字符串中使用Pooling = False吗? [英] Should i use Pooling=False in Entity Framework Connection String?

查看:290
本文介绍了我应该在实体框架连接字符串中使用Pooling = False吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们有一个运行在Azure上的ASP.Net MVC3应用程序,它通过实体框架连接到Sql Azure数据库.

We have an ASP.Net MVC3 application that is running on Azure, connecting to a Sql Azure Database via Entity Framework.

产生此结果的开发人员在连接字符串中具有Pooling = False.我本以为这是个坏主意-如果可能的话,我们是否不想重复使用这些连接?

The Developer that produced this has Pooling=False in the connection string. I would have thought this was a bad idea - wouldn't we want to re-use the connections if possible?

任何人都可以给我一些指导,这可能是个好主意吗?

Can anyone give me some guidance of when this might be a good idea?

谢谢!

推荐答案

是的,有pooling = False是个坏主意.即使开发,我也不会使用此选项.您应该始终使用SQL Server连接池.

Yes, it is bad idea to have pooling=False. I don't use this option even for development. You should always use the SQL Server Connection Pooling.

但是,您需要了解的是SQL Azure中的瞬时错误.在Internet上可以找到有关如何使用实体框架处理SQL中的瞬时错误的一些不错的读物.以下是一些列表(不完整):

What you have to be aware of, however is the Transient Errors in SQL Azure. There are a couple of good reading that can be found on the Internet on how to handle Transient Errors in SQL using Entity Framework. Here is a (non-complete) list of some:

  • Best practices for handling Transient conditions in SQL Azure
  • SQL Azure and EF fault handling
  • EF CodeFirst and Transient Errors
  • Handling Transient Errors in SQL Azure

始终使用连接池,但是请注意SQL Azure中的瞬态条件.

Always use connection pooling, but be aware of the Transient conditions in SQL Azure.

这篇关于我应该在实体框架连接字符串中使用Pooling = False吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆