[thelist] best practice question

Peter Brunone (EasyListBox.com) peter at easylistbox.com
Tue Aug 8 14:29:59 CDT 2006



				> > You could do it when the application starts and 
> > load it into Cache...
> 
> Would this not defeat the object of connection pooling?

   By "load it into Cache", I was referring to the connection string... which, granted, only does a small part of the optimization Casey was after.  Apologies for the vague use of pronouns :)

   For what it's worth, I do something similar to what (I think) you mentioned.  I have a small database class that exposes shared methods like GetScalar, GetReader, FillDataSet, and so on.  It has a default connection string (set to the standardized name I give to the main conn string in web.config) but it can be given a new string as an optional parameter if needed.  Further overridden methods are available for things like transaction support, and I'm sure you could do much more with it.

				Cheers,

Peter 

				From: Chris at globet.com

Peter

[..]

> > Dim dbConnect As SqlConnection = New
> > SqlConnection(ConfigurationSettings.AppSettings("dataConnection"))
> > 
> > What's the best method to keep from repeating this line in 
> > each and every .ascx or .aspx file? In other words, I'd like 
> > dbConnect to be a global object that I don't need to 
> > instantiate on every page, and certainly not within every 

[..]

> You could do it when the application starts and 
> load it into Cache...

Would this not defeat the object of connection pooling?

-- 
Chris Marsh
Software Developer



More information about the thelist mailing list