I’ve always been bothered by writing code like:
public class HomeController : Controller
{
public ActionResult Index()
{
return View();
}
public ActionResult About() {
return View();
}
public ActionResult Terms() {
return View();
}
public ActionResult Privacy() {
return View();
}
public ActionResult About() {
return View();
}
}
So many methods doing the same thing and possibly scattered across many controllers… Sometimes inheritance works, but sometimes it’s not a possible solution. Castle’s Monorail has dynamic actions to address this problem. In this Code Voyeur article I demonstrate how to solve the problme in ASP.NET MVC.