bubby,
In this case, you would implement IDisposable on the abstract class. On
your abstract class, you would have a method with the following signature:
protected virtual void Dispose(bool disposing)
{
}
This is what would be overridden in base classes to dispose their
resources. When implementing this, the boolean disposing value is going to
tell you whether or not you are being called from the finalizer or from the
Dispose method.
Check out the article on MSDN titled "Implementing Finalize and Dispose
to Clean Up Unmanaged Resources", located at (watch for line wrap):
http://msdn.microsoft.com/library/de...izeDispose.asp
It goes into great detail how you should implement IDispose on your base
class, as well as override the protected Dispose method in your derived
classes.
Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
-
mv*@spam.guard.caspershouse.com
"bubby" <aj******@yahoo.com> wrote in message
news:11**********************@z14g2000cwz.googlegr oups.com...
I have a database interface class (an abstract class) that has two
derived classes that work with two different types of databases. If
the dervied classes have managed, and unmanged resources and the base
(abstract) class doesn't, how do I implement the IDisposable interface?
Do I have the base (abstract) class inherit from IDisposable? If I
do, how will that work since the class is abstract and no instance is
actually created. Or, should I just implement the interface
IDisposable off of the two derived classes?
Thanks!
bubby