Ninject Dependency injection container
- Upgraded reference to DD4T.Core
- Suppress warnings about obsolete methods in IComponentProvider
- Install Nuget package:
Install-Package DD4T.DI.Ninject
http://www.nuget.org/packages/DD4T.DI.Ninject - Add
DD4T.DI.Ninject
namespace to your usings; - Call the
UseDD4T
method on your NinjectNinject.IKernel
interface.
IKernel kernel = new StandardKernel(); //set all your custom apllication binding here. kernel.UseDD4T();
UseDD4T will Register all default class provided by the DD4T framework.
If you need to override the default classes: (i.e. the DefaultPublicationResovler) Register your class before the method call UseDD4T
IKernel kernel = new StandardKernel(); //set all your custom apllication binding here. kernel.Bind<IPublicationResolver>().To<MyCustomPublicationResovler>().InSingletonScope(); kernel.UseDD4T();