在共享一个C#应用程序的线程之间的数据库连接? [英] Sharing a db connection between threads in a C# application?

查看:339
本文介绍了在共享一个C#应用程序的线程之间的数据库连接?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我发现那里是关于这个主题的信息非常少,希望有人能告诉我一些资料和可能的示例代码。

I have found there to be very little information on this topic, was hoping someone could direct me to some information and possible sample code.

推荐答案

一般连接不是线程安全的(SqlConnection的,和的MySqlConnection专门的OracleConnection提它们不是线程安全)。

Generally connections are not thread safe(SqlConnection ,MySqlConnection and OracleConnection specifically mention that they are not thread safe).

不要线程之间共享的连接

Don't share a connection between threads.

这篇关于在共享一个C#应用程序的线程之间的数据库连接?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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