I'm slightly confused over the following:
-------- GetUsers (Implements IDBConnector)
I have two projects one main project (project B) and another which gets data from a database (project A). Project A has an interface which the main class makes use of. The GetUsers class is then injected within the main class of type IGetUsers.
This means there is a dependency of Project A for Project B as Project B needs to know how the interface is defined and the class definition itself. I am fine with this from a code standpoint but I can't help thinking that the interface should be kept somewhere else as it is essentially a contract and I am trying to follow the open/closed principle i.e. I shouldn't have to touch the main class to change how the database interaction is dealt with. In my example however if I remove Project A I lose the interface definition and I would have to modify the Main class.
I would have thought that Project B would be a good place to keep the interface but this would result in a circular reference as Project A would need to reference Project A for the interface declaration and vice versa for the class implementation.
The other option is to have a separate project for interfaces which I have seen mentioned in this question:
But to me this seems a little silly to have this example interface in a whole separate project while there is only one interface at current.