Multi binding and contextual binding
In the previous chapter, we saw how Ninject can resolve dependency types in single binding situations, that is, each service type is bound only to a single implementation type. However, there are situations where we need to bind an abstract service type to multiple implementations, which is called as multi binding. Multi binding has two scenarios. The first one is the plugin model implementation and the other one is contextual binding, which we will discuss in this section.
Implementing the plugin model
The plugin model allows an application to be extremely extensible without modifying its source code. In the following example, we will implement a Music Player application, which uses codec plugins in order to support different music formats. The application comes out with two built-in codecs, and it is possible to add more plugin codecs and extend the formats that our player application supports. Please note that as we try to keep the application as simple...