If I read the docs correctly, Close ( ) calls Dispose ( ) for the Connection.
However, I would like to know more about the proper way to dispose of resources. ----- Original Message ----- From: "Peter Foreman" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Tuesday, June 11, 2002 1:25 PM Subject: Re: [DOTNET] ADO.NET and Dispose > --- Chris Anderson <[EMAIL PROTECTED]> wrote: > > I just would like to know what the most appropriate techniques are for > > Disposal of ADO.NET objects > > > > Basically..Am I going overkill on the Dispose methods? > > Not IMO. > > > Also...What resources are actually being disposed? > > It depends. The connection is obviously the most important, but also the command can hold > precious resources. (I believe from previous postings that the Oracle provider does so). And > that's the real bugbear with dispose - what it does obviously depends on implementation, and for > similar classes it may do different things. Add to this the tendency for implementations to > change over time. > > The best course of action IMO is to always dispose. If possible wrap your data layer up in a > simple abstraction, to prevent you writing repeatative code. > > > I can't find anything in the docs about it (just that Dispose should be > > called if it exists, and you're finished with it) and the ADO.NET books I've > > looked through rarely call Dispose at all (perhaps with the same reasoning > > that error handling is rarely shown in books..to make the point of the > > example clear) > > I agree wholeheartedly. The trouble is that the example is the exact opposite from clear, you > scratch your head wondering what you should dispose. > > Peter > > __________________________________________________ > Do You Yahoo!? > Yahoo! - Official partner of 2002 FIFA World Cup > http://fifaworldcup.yahoo.com > > You can read messages from the DOTNET archive, unsubscribe from DOTNET, or > subscribe to other DevelopMentor lists at http://discuss.develop.com. You can read messages from the DOTNET archive, unsubscribe from DOTNET, or subscribe to other DevelopMentor lists at http://discuss.develop.com.