Questions tagged [t4mvc]

T4MVC is an open source utility for Microsoft ASP.NET MVC. It allows replacing magic strings in Views, Controllers and Links to content with strong names/types.

T4MVC is an open source utility for Microsoft ASP.NET MVC. It allows replacing magic strings in Views, Controllers and Links to content with strong names/types.

Resources

245 questions
1
vote
1 answer

T4MVC Generates controller empty constructor

Why does T4MVC generate controller default constructor? Just curious.
SiberianGuy
  • 24,674
  • 56
  • 152
  • 266
1
vote
1 answer

Using T4MVC JavaScriptReplaceableUrl

I'm trying to use T4MVC to make action links strongly typed and easier to maintain. Example from HERE var myUrl=<%= Url.JavaScriptReplacableUrl(MVC.Dinners.Display())%> //myUrl will be Dinners/Display/{dinnerId} var…
Hardycore
  • 334
  • 4
  • 17
1
vote
1 answer

T4MVC and named parameters

I'm running into an error with T4MVC and named parameters. I have a controller: public class ProductsController : Controller { public virtual ViewResult List(int page = 1) { // foo.DoSomething() } } It seems T4MVC creates an…
Gabriel Florit
  • 2,886
  • 1
  • 22
  • 36
1
vote
3 answers

ASP.NET MVC Expression is rendered "as is"

I have the following line: which is rendered to So expression is…
SiberianGuy
  • 24,674
  • 56
  • 152
  • 266
1
vote
0 answers

MVC 5. AddRouteValue method doesn't work with constraint

First of all, I need to say that I'm using T4MVC. I have such Action: public virtual ActionResult List(string slug, string category, String selectedFilters) And route for this Action: routes.MapRoute("ProductsList",…
Alex Gurskiy
  • 346
  • 1
  • 7
  • 20
1
vote
1 answer

How can you get T4 to skip transforming for custom methods?

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…
Tristan Warner-Smith
  • 9,631
  • 6
  • 46
  • 75
1
vote
0 answers

T4MVC: Empty link on shared view when controller is in an area

I have a shared view which contains a link to an action on a top-level controller. I render this view from two controllers: one is in an area, and the other isn't. When the following is rendered after being called from the controller inside the…
awj
  • 7,482
  • 10
  • 66
  • 120
1
vote
1 answer

How to add reference an assembly that is not in the GAC from a t4mvc template (.tt)

I have found the place near the very top in a T4MVC template file (.tt) where assembly references can be added, which looks like: <#@ assembly name="System.Core" #> <#@ import namespace="System.Collections.Generic" #> However, it seems that I can…
stephen
  • 1,200
  • 1
  • 13
  • 16
1
vote
0 answers

T4MVC Extension not calling subclass or mocked method of UrlHelper

Now UrlHelper has been made friendly for unit testing I wanted to replace old test code with a mocked version. However I can't seem to get T4MVC's Action extension method to actually call the mocked method, it keeps hitting UrlHelper's method…
Chris
  • 2,447
  • 1
  • 21
  • 27
1
vote
1 answer

MVC + T4MVC - How to pass a url action to form? Or an alternative method to generate action/id?

I'm looping through a model and iterating through data. I want to add a button on each item that generates an action/id. As I cannot add a url to a button , I've decided to use a form with the following:
DarkShadowAY
  • 175
  • 4
  • 15
1
vote
2 answers

How can I generate constant urls for my ASP.NET MVC actions?

I want to generate constant urls for my actions. Something like this: public const string ControllerName_ActionName = "/ControllerName/ActionName"; I have tried to use T4MVC but it generates only methods with T4MVC_System_Web_Mvc_ActionResult. Is…
Neshta
  • 2,605
  • 2
  • 27
  • 45
1
vote
1 answer

any solution like T4MVC for external JS files?

I m using T4MVC in MVC project. My question is is there such a solution for external JS files ? Many times there need to use URLs or strings (to compare) in external JS files. A change in sting break application. Or please advice T4MVC can be used…
user576510
  • 5,777
  • 20
  • 81
  • 144
1
vote
0 answers

How can I create a Custom ActionLink in ASP.NET MVC that uses T4MVC?

I want to create a Custom ActionLink (Custom Html Helper) that uses T4MVC... I do not know how to implement it.
1
vote
0 answers

Upgrading to Signalr 2.1.1 causes response to not be found now

When calling a method on a hub I am now getting an error for the last line below. This wasnt happening before. I am using T4MVC. Error Additional information: Response is not available in this context. Hub public void Viewing() { …
Mike Flynn
  • 22,342
  • 54
  • 182
  • 341
1
vote
1 answer

Fluent Assertions ThatAreNotDecoratedWith

I would like to use FluentAssertions to test for all methods that are not decorated with the NonActionAttribute. (This will reduce the set of action methods automatically generated as placeholders by T4MVC.) My specific problem is with chaining…
Kevin Swarts
  • 435
  • 7
  • 17