How to use Ninject with ASP.NET MVC(codeclimber.net.nz)
submitted by
justin_etheredge(8539) 3 years, 3 months ago
By default, the ASP.NET MVC framework instantiate controllers calling their default constructor. This makes using Dependency Injection impossible. But, as almost everything inside that framework, the logic with which a controller is instantiated can be replaced with you own logic. This can be done creating your own ControllerFactory, which is pretty simple. But if you are using one of the many popular DI/IoC libraries, that task is even simpler, since there are already custom controller factories for almost all the IoC libraries available. In this post we are are going to see how to use the ControllerFactory that delegates to Ninject the creation of your controllers.
|category: C#
|Views: 238
tags:
NInject ASPNETMVC C# CodeClimber another
Everyones tags:
Your Tags: