B
Buddy Ackerman
I have taken over an application that has a sealed (singleton) class for database access. I want to add a private
SQLConnection class variable and open the connection it whenever it is instantiated and close it when the class it
disposed. I do this so that I can call mutiple methods within the class without having to open a connection each time.
I implemented an IDisposable interface (and a finalize interface) but it doesn't appear to work so I'm left with open
database connections. Is it just not possible to implement IDisposable on a singleton class? Should I jsut implement
finalize (if that's even possible)?
On a side note I don't see any reason to even have the Database class be a singleton. I plan on chnaging it in the
future but I don't have time to do it now.
--Buddy
SQLConnection class variable and open the connection it whenever it is instantiated and close it when the class it
disposed. I do this so that I can call mutiple methods within the class without having to open a connection each time.
I implemented an IDisposable interface (and a finalize interface) but it doesn't appear to work so I'm left with open
database connections. Is it just not possible to implement IDisposable on a singleton class? Should I jsut implement
finalize (if that's even possible)?
On a side note I don't see any reason to even have the Database class be a singleton. I plan on chnaging it in the
future but I don't have time to do it now.
--Buddy