Reputation: 1303
I have below situation :
I have One project "Logger" which has class concrete class named "Log" And this "Log" is inherited from interface "Ilog" which is refereced from project "Common" which has all interfaces
So now the solution looks like
MainSolution -Logger(CLASS LIBRARY) - Log.cs
Common(CLASS LIBRARY)
Cache(CLASS LIBRARY)
Now cache.cs also needs to use Logging and i don't want to use reference of logger project, and just use the Common project reference and achieve the logging.
Please give some way out of it.
Upvotes: 1
Views: 263
Reputation: 14919
You can use IOC to resolve this problem. By using IOC, you only reference the Common
class library in Cache
library; but call methods on Log
class.
All you need to do is to create a container; map your interfaces to your objects by using either a configuration file or by coding; and resolving your objects by means of IOC.
You may refer to this link and this link for Unity IOC.
Upvotes: 1
Reputation: 38825
"I don't want to use the project that has the code in, but I do want to use it" is rather ill-thought-out.
Just use it or reimplement ILog in the Cache class library.
Upvotes: 0