I have an interface (IDbAccess) for a database access class so that I can unit test it using Unity. It all works fine in Unity and now I want to make the concrete database class implement IDisposable so that it closes the db connections.
My problem is that Unity does not understand that my concrete class is disposable because the interface (IDbAccess) cannot implement another interface.
So how can I write code like this (pseudo code) so that Unity is aware that it needs to dispose the class as soon as I am done?
Using var MyDbAccessInstance = Unity.Resolve<IDbAccess>
{
}
Thanks
Ryan