I have a problem similar to the one described here: http://stackoverflow.com/questions/1128003/mvc-t4-mvctexttemplatehost-and-customized-controller-t4-template but hopefully, simpler.
I have a custom View templates (View.tt, Create.tt) for ASP.NET MVC project. I can't figure out how to get the controller name in these view templates. mvcHost.ControllerName and mvcHost.ControllerRootName both are null in View templates. However, somewhere in the pipeline controller name is known, since the view is created int the ControllerName folder. I want to refer to it in the template itself.
Specifically, I want to generate HTML.ActionLink("Edit", MVC.<controllername>.Edit(id))
instead of HTML.ActionLink("Edit", "Edit", new {id = item.id})
Is it possible to get the name of the controller in the View template?