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
  • 57,247
  • 24
  • 95
  • 149

4 Answers4

1

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

Bas
  • 26,014
  • 8
  • 49
  • 85
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,500
  • 3
  • 32
  • 52
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,533
  • 2
  • 31
  • 52
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
  • 15,555
  • 5
  • 30
  • 53