C#Windows应用程序 - 使用同一连接的多个线程? [英] C# Windows Application - Many threads using the same connection?

查看:176
本文介绍了C#Windows应用程序 - 使用同一连接的多个线程?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个C#Windows应用程序的多线程。这是我的理解是,在网络环境中,连接自动汇集。这也是我的理解,在一个Windows应用程序,这是并非如此。因此,对于一个Windows应用程序,同样的连接,应使用与每个呼叫之后没有关闭,而是关闭时,应用程序将关闭。

I've got a c# WINDOWS Application that is multi-threaded. It is my understanding that in a web environment, connections are pooled automatically. It is also my understanding that in a Windows app, this is not the case. Therefore, for a Windows app, the same connection should be used and not closed after each call, but instead closed when the app shuts down.

我很好奇,虽然 - 是我正确的吗?如果是,可以在两个线程使用相同的连接到从DB数据集的同时或是排队?该功能

I'm curious though - is my correct? If it is, can two threads use the same connection to get a dataset from the DB at the same time or is that functionality queued up?

感谢

推荐答案

连接池是ADO.NET的一个特点。因此,连接已汇集。不仅在网络环境。

The Connection Pooling is one feature of ADO.NET. Therefore the connections are already pooled. Not only in the web environment.

<一个href="http://www.ondotnet.com/pub/a/dotnet/2004/02/09/connpool.html">http://www.ondotnet.com/pub/a/dotnet/2004/02/09/connpool.html

这篇关于C#Windows应用程序 - 使用同一连接的多个线程?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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