I'm in the process of developing an extensible framework using DI and IoC. Users must be able override existing functionality within the framework by dropping their own implementations into the container.
How can I allow users to do this without requiring them to know which IoC container I am using?
My current half-way solution is to structure my assemblies as follows:
1) Define abstract assemblies containing only interfaces.
2) Define concrete assemblies which implement these interfaces. Users may define their own to override existing functionality.
3) Define the container bindings in separate assemblies; i.e. one binding assembly per concrete assembly.
This means the concrete assemblies are not coupled with a particular IoC container, and they would be closed against change if I used a different container. However, users are still required to know which container my framework is using in order to write the binding assemblies, and they would need to release new binding assemblies if I changed the IoC container (i.e. from Ninject to Spring).
Am I missing something?
Write loosely coupled code. Applications should depend on containers. Frameworks should not.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With