Using T4MVC in real project
Asked Answered
B

1

9

T4MVC is cool, but I have a couple of issues integrating it in my project, any help is really appriciated:

  1. I've got such warnings for all my actions (I use SnippetsBaseController as base class for all my controller classes:

    Warning 26 'Snippets.Controllers.ErrorController.Actions' hides inherited member 'Snippets.Controllers.Base.SnippetsBaseController.Actions'. Use the new keyword if hiding was intended. C:\projects_crisp-source_crisp\crisp-snippets\Snippets\T4MVC.cs 481 32 Snippets

  2. Is it possible to have strongly typed names of custom Routes, for example, I have route defined like this:

        routes.MapRoute(
            "Feed",
            "feed/",
            MVC.Snippets.Rss()
        );
    

Is it possible to replace:

<%= Url.RouteUrl("Feed") %>

with something like:

<%= Url.RouteUrl(MVC.Routes.Feed) %>
  1. Having strongly typed links to static files is really cool, but I use <base /> in my pages, so I don't need any URL processing, can I redefine T4MVCHelpers.ProcessVirtualPath without tweaking the T4MVC.tt itself?

  2. T4MVC always generate links with uppercased controller and action names, for example: /Snippets/Add instead of /snippets/add. Is it possible to generate them lowercase?

Backflow answered 26/4, 2010 at 6:8 Comment(1)
Remember to always check developer's documentation: github.com/T4MVC/T4MVC/wiki/…Keener
A
18
  1. Can you change your base controller class to be abstract? I think that'll fix it.

  2. See this post which discusses this: http://forums.asp.net/t/1535567.aspx

  3. If you look in t4mvc.settings.t4, you'll see a ProcessVirtualPathDefault method that you can change without touching the main .tt file.

  4. See http://forums.asp.net/t/1532057.aspx. There is suggested fix in there, though it has not yet been submitted (but you can try it).

David

Angadresma answered 26/4, 2010 at 15:45 Comment(3)
For (1). Switching to abstract base class helped, but one warning still active: Snippets.Controllers.SnippetsController.View()' hides inherited member 'System.Web.Mvc.Controller.View()'. Use the new keyword if hiding was intendedBackflow
I don't think T4MVC generates something called 'View'. You're sure it's not something in your base controller itself?Angadresma
Ahhr. it seems to be not T4MVC related, I have action called View(), I'll try to use [ActionName]. thanks for answering my fast and simple questions!Backflow

© 2022 - 2024 — McMap. All rights reserved.