I am currently working on a project, and it will be mainly based on the library.
I want the library to be consumed using dependency injection, but I want the library to be largely agnostic to the container used.
I wrote a “bridge” library some time ago to make it easier, but I was not sure if this was the correct approach? (library: https://github.com/clintkpearson/IoCBridge )
I do not want to refer to the DI technology (Ninject, Windsor, etc.) directly from my library, and then makes it inflexible for people using it.
There are a few more questions on SO in a similar vein, but none of them seem to satisfy the problem satisfactorily.
As an additional note : I understand that I can just make sure that the library adheres to a common idiom and uses the ctor interfaces and arguments for dependencies, and then just leave it to the consumer application to register types in containers.
The only problem I see with this (and correct me if I am wrong) is that this requires a consumer application, actually know , that defines a link to which interfaces are registered as singleton, etc. .. and in terms of using plug-and-play, which are pretty poor.
Clint source