Yeah, that's prolly not a good idea. Try letting the default connection
pooling behavior work. This is automatic if you don't disable it. What
happens is that IIS will keep a pool of connections open - one per
connect-string user/credential pair, and reuse an unoccupied connection
when another connection just like it comes along. If there are different
connects (different user creds) you don't get any benefit under high load -
but for cases where you are making your service log in with a specific set
of credentials, connection pooling is your friend.
--------------------GMT)>From: "Ben Ong" <ben.ongnatoil.com>
>Newsgroups: microsoft.public.dotnet.framework.aspnet.webservic es
>Subject: When to use a singleton class?
>Date: 8 Mar 2005 12:31:44 -0800
>Message-ID: <1110313904.801246.63500l41g2000cwc.googlegroups. com>
>Content-Type: text/plain; cht="iso-8859-1"
>X-Trace: posting.google.com 1110313909 3661 127.0.0.1 (8 Mar 2005 20:31:49TK2MSFTNGXA02.phx.gbl!TK2MSFTNGXA01.phx.gbl!TK2MSF TFEED02.phx.gbl!tornado.fa>X-Complaints-To: [email]groups-abusegoogle.com[/email]
>NNTP-Posting-Date: Tue, 8 Mar 2005 20:31:49 +0000 (UTC)
>Injection-Info: l41g2000cwc.googlegroups.com; posting-host=220.127.116.11;
com!l41g2000cwc.googlegroups.com!not-for-mailmicrosoft.public.dotnet.framework.aspnet.webservic es:28509>Xref: TK2MSFTNGXA02.phx.gbl>X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet.webservic es
>I created a singleton class in my .NET app to solely handle opening and
>closing a connection to my database. I was wondering if this is a
>good design or not. And can someone confirm with me: that a singleton
>class has only one instance of itself correct? So if i have multiple
>users using the same app and they connect through my database
>connection class, will only one of the users be able to connect to the
>db at a time?