Re: disposing the database object??

Tech-Archive recommends: Fix windows errors by optimizing your registry




"ajmastrean" <ajmastrean@xxxxxxxxx> wrote in message news:1166099283.884550.314080@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
There is no .Dispose() function for the Database object.

The OP did not show the class structure there, but I suppose the
garbage collector will handle disposing that object when he exits the
function or when the entire class is disposed (whatever the case may
be).

Only the former is possible while the later isn't.


If he simply wants to keep his database objects/connections in order,
then there is no real issue. The database object returned by
DatabaseFactory.CreateDatabase() is not responsible for closing
connections, the db.ExecuteScalar() will do that.

Yes, it is very possible that Database instance doesn't need disposing...
--
Miha Markic [MVP C#, INETA Country Leader for Slovenia]
RightHand .NET consulting & development www.rthand.com
Blog: http://cs.rthand.com/blogs/blog_with_righthand/

.



Relevant Pages

  • Re: how to remove a programmatically created DateTimePicker
    ... Apparently my laptop got a life ... "The garbage collector runs in time intervals, ... unmanaged resources, that has not much to do with disposing an object, ... disposing of an object is done by the GC. ...
    (microsoft.public.dotnet.languages.vb)
  • Re: how to remove a programmatically created DateTimePicker
    ... "The garbage collector runs in time intervals, ... unmanaged resources, that has not much to do with disposing an object, ... disposing of an object is done by the GC. ...
    (microsoft.public.dotnet.languages.vb)
  • Re: Lisp in hardware
    ... Alexander Burger writes: ... so that for example the garbage collector can do special things ... > with it (like not always disposing of it, ...
    (comp.lang.lisp)
  • Re: Delphi32 & Delphi.NET Should Both Have *Optional* Garbage Collection
    ... Bryce, ... With VCL.NET, can't you either free/dispose everything yourself via the "normal" way, or let the garbage collector get it when it wants? ... it's not free-ing, it's disposing. ...
    (borland.public.delphi.non-technical)