2

Is there a lint utility for ASP.NET MVC? Given that I frequently specify views and links via strings, when I move things around or change entity names I often break things, which I then only find out about when something fails at runtime.

tereško
  • 58,060
  • 25
  • 98
  • 150

4 Answers4

1

You can use Refactor -> Rename and enable Search in Strings to replace every string in the solution

Bas
  • 26,772
  • 8
  • 53
  • 86
1

Other option -- use the strongly typed helpers (which might still be in the futures assemblies). EG, Html.Action<ProductsController>(x => x.ShowProduct(id)) ; really the only way to fly.

Wyatt Barnett
  • 15,573
  • 3
  • 34
  • 53
1

ReSharper's v6 (whose nightlies are now available, if you don't mind living on the edge) will catch this kind of error for you.

Dan Davies Brackett
  • 9,811
  • 2
  • 32
  • 54
0

I don't know that there's something like that, but I'll tell you what I do: All my view names are in a struct that contains string constants. It's a pain to keep it sync'ed as the project changes, but it's worth it because you're far more likely to catch errors if you're using

ViewNames.Customer

rather than

"customer"
kprobst
  • 16,165
  • 5
  • 32
  • 53