I want to setup Ninject to do a simple test, as well as demonstrate the ease-of-setup using Nuget. I want to resolve a sample service.
public interface ITestSer
Steps:
Install-Package Ninject.MVC3
In HomeController:
public class HomeController : Controller
{
private readonly ITestService _service;
public HomeController(ITestService service)
{
_service = service;
}
public ActionResult Index()
{
ViewBag.Message = _service.GetMessage();
return View();
}
}
In App_Start/NinjectMVC3.cs
:
private static void RegisterServices(IKernel kernel)
{
kernel.Bind().To();
}