Let's say for a Net Core library that I will deliver to the customer
The library define a Interface like IGetData and also a default GetData class.
The library also define a ICacher interface with a default Cacher class
It's the client's responsibility to register the Interface and the default Classes to their DI container. They can also define and register their own Cacher
My question is :
1/ Is there something wrong with this design ?
2/ Normally how a dependency that is optional should be handled ?
3/ In the case that the optional dependency is handled correctly, my GetData class would contains something like
If(Cacher != null) return Cacher.GetData()
Is this also normal?