ASP.NET MVC 4 Wiki - Setting Up a Dependency Injection Container by Implementing IDependencyResolver
A simple way to setup a IoC with a DI container in your ASP.NET MVC application is by implementing IDependencyResolver and registering your very own dependency resolver to handle object instantiation and lifetime.
First, install Ninject in your project via NuGet package manager console:
Install Ninject via Nuget
Then provide an implementation for IDependencyResolver:
In short, the problem with Service Locator is that it hides a class’ dependencies, causing run-time errors instead of compile-time errors, as well as making the code more difficult to maintain because it becomes unclear when you would be introducing a breaking change.
Use it under your own risk :). Anyhow, as long as you don’t explicitly use dependencyResolver.Get() and limit yourself to constructor injection you should be fine.