The title really says it all. I have some Action methods that don't use the repository at all, like this Index() method that just displays a static page.
public ActionResult Index()
{
return View();
}
Seems to me like instantiating the Repository in the controller is a waste of time in these cases... but for IoC, I want to hand in an interface, so that has to happen in the controller:
public PerfMvcController(IPerfRepository repo)
{
repo = repo ?? new PerfRepository();
}
I would be interested in the best practice for instantiating a repository in a controller using IoC, in a nutshell.