September 8, 2013

Dependency Injection using Ninject in MVC 4

Today let's talk how to implement DI using the most popular IoC container Ninject in MVC 4, because it differs from the previous versions of framework.

Small recall: the dependency injection is a software design pattern, which allows us easily change hard-coded dependencies between interfaces and their implementations.

Problem statement: for example we have HomeController and GuestController classes, which tightly coupled to the HomeService class as on the image below.