[thelist] best practice question
Peter Brunone (EasyListBox.com)
peter at easylistbox.com
Tue Aug 8 15:00:43 CDT 2006
> Okay, but then you still need to instantiate the object "dbConnect" on
> as needed basis. What I'm wondering if there is a way to only
> instantiate it once per application, and then refer to it as many times
> as needed.
There is, but -- as Chris pointed out when responding to what he thought was my suggestion of something similar -- it REALLY doesn't scale well for multi-user applications. I think the following analogy from http://www.learnasp.com/freebook/asp/sessionoverview.aspx really applies here:
A Porsche seems really fast to get anywhere... until you have 3-10 passengers. Then a mini-van will beat it because you have less trips to make. In client-server terms the Porsche doesn't SCALE WELL for more than 2 passengers. On the other hand, when a group of 100 wants to go to Atlantic city for the weekend we recommend a Tour Bus. However, someone taking a Tour Bus to the grocery store has anecdotal evidence it is not as fast as a Porsche.
Storing one connection object for repeated use is a great idea... until more users need to get to it at once.
If you want to abstract out the connection creation, you'd do better to use the approach I mentioned earlier (not that it's the best or only way) and just add methods as needed, depending on what you need from the object.
HTH,
Peter
From: "Casey Crookston" <caseyc at IntelliSoftmn.com>
Sent: Tuesday, August 08, 2006 12:41 PM
To: thelist at lists.evolt.org
Subject: Re: [thelist] best practice question
CHRIS:
I have used a SqlHelper class with (amongst others) a static method
GetConnection(). When I need a connection, in VB I would specify:
Dim dbConnect As SqlConnection = SqlHelper.GetConnection()
CASEY:
Okay, but then you still need to instantiate the object "dbConnect" on
as needed basis. What I'm wondering if there is a way to only
instantiate it once per application, and then refer to it as many times
as needed.
--
* * Please support the community that supports you. * *
http://evolt.org/help_support_evolt/
For unsubscribe and other options, including the Tip Harvester
and archives of thelist go to: http://lists.evolt.org
Workers of the Web, evolt !
More information about the thelist
mailing list