Regarding pooling: unless you explicitly turn off pooling in your connection
string, then you will end up with connection pooling with a default number
of 100 connections. If you are using the connections in such a way that you
can't re-use them, then this pool will diminish even faster. This could
cause problems as your user base expands.
Regarding IDisposable: Unless you need to hold in the state of your object
some scarce resources, then you have no reason to expose this interface
yourself. You should, however, make a point to properly use this interface
in the objects you are using that expose this interface. If you are using
C#, you can use the using keyword to make this easy. For example:
using (SqlConnection myConnection = new SqlConnection(...)) {
// do something with the connection
}
Using functions in much the same way as a try ... finally clause would,
guaranteeing to call Dispose as soon as you are done using the connection,
either releasing it to the pool or else returning those resources to the
system. With scare resources, you should make it a point to free them up as
soon as you have the opportunity to do so. Because garbage collection is
non-deterministic, you could run out of your scarce resources long before
you run out of the resources that trigger garbage collection.
--
Chris Jackson
Software Engineer
Microsoft MVP - Windows Client
Windows XP Associate Expert
--
More people read the newsgroups than read my email.
Reply to the newsgroup for a faster response.
(Control-G using Outlook Express)
--
"Paul M" <ma****@trials.bham.ac.uk> wrote in message
news:ew**************@TK2MSFTNGP10.phx.gbl...
Hi folks,
Given the nature of asp, when I'm constructing data bound middler tier
objects, is it necessary to implement the Idisposable interface or is it
good enough to rely on a Finalize call.
Most of my applications will be using Forms authentication and as such the
sql server connection objects will all have individual user id's i.e. no
connection pooling, and because of the time between posts, I can't see any
reason not rely on the normal garbage collection.
Any comments would be much appreciated...
Thanks...P
P.S Since when did the Oxford English Dictionary spell Finalise with a Z??
Bloomin' nuisance.