September 2013
Intermediate to advanced
142 pages
2h 58m
English
Providers are specialized factory classes that Ninject uses in order to instantiate resolved types. Whenever we bind a service type to a component, we are implicitly associating that service type to a provider that can generate instances of that component. This hidden provider is a generic factory, which can create instances of every given type, and is called
StandardProvider. Although we can often rely on StandardProvider without having to bother about what it does behind the scenes, Ninject also allows us to create and register our custom providers just in case we need to customize the activation process as follows:
Bind<IService>().ToProvider<MyService>(); public class MyServiceProvider : Provider<MyService> { protected override ...Read now
Unlock full access