Should Dispose be invoked?

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Quote from ADO.NET MOC, Module 2 - Connecting to Data Sources, p18:

"Calling the Dispose method removes the connection from the connection pool."

Does this mean that it's not advisable to call Dispose on a connection
unless the application is terminating? Otherwise, connection pooling is
programmatically disabled, in effect. Can anyone clarify this? Thanks =)
 
jester said:
Quote from ADO.NET MOC, Module 2 - Connecting to Data Sources, p18:

"Calling the Dispose method removes the connection from the connection pool."

Does this mean that it's not advisable to call Dispose on a connection
unless the application is terminating? Otherwise, connection pooling is
programmatically disabled, in effect. Can anyone clarify this? Thanks =)

That's false - it's an urban myth.

See

http://groups.google.com/groups?selm=MPG.1b16f30b73488be98a988%
40msnews.microsoft.com&rnum=1
 
Jester,

It is adviced (except with MS access) to close your connections when
datatransfer has ended. In the case of the connection using really dispose
instead of close and that as one of the exceptions while normally close is
sufficient.

I hope this helps,

Cor
 
Hi jester,

Just to add something to the thread:
As previously mentioned the Dispose does nothing to the pool and you really
should call it even if it does nothing at this time - it could change in the
future.
 
Back
Top