1

Is there any attribute or other method of getting T4 to skip trying to transform custom methods?

Where it shows a warning saying T4MVC.tt doesn't support MyController.Method because it doesn't return a supported ActionResult type?

For example:

On a BaseController having this method:

public UrlHelper GetUrlHelper()
{
    return new UrlHelper(this.ControllerContext.RequestContext);
}
Tristan Warner-Smith
  • 9,631
  • 6
  • 46
  • 75

1 Answers1

3

Ah yes, I assume you're the one who asked during the MvcConf talk :)

I think we should just change T4MVC to just get rid of this warning, which probably does more harm than good. Can you try getting rid of it in t4mvc.tt? Should be around line 776 in the latest build.

I can just make that change and it will go in the next drop (2.6.22), but please let me know if that works well for you. Thanks!

David Ebbo
  • 42,443
  • 8
  • 103
  • 117
  • I'm using version 3.7.7 and that warning seems to have been re-added; or maybe it was never removed? I found the relevant line in the `.tt` file and commented it out but is there any reason why I shouldn't do that? – Kenny Evitt Apr 07 '14 at 19:50
  • What is the exact text of the warning you are seeing? – David Ebbo Apr 08 '14 at 01:33
  • 1
    I to get this warning. Example Line: ```Warning 4 Running transformation: T4MVC.tt doesn't support BaseController.LoadHelperModel because it doesn't return a supported E_Tabs.Dashboards.Web.Common.Models.HelperModel type 1 1``` Using version 3.9.1. the warning line is around line 855. The strange thing is that I have the Action marked as "NonAction" and it still attempts to map to it. Note that this is not really a big deal ... just letting you know. – ACG Apr 27 '14 at 10:25
  • That's strange because the NonActionAttribute check happens before that line. Anyway, I'll just comment out that warning in next release. – David Ebbo Apr 28 '14 at 05:20