ASP.Net MVC Action methods compile time errors in Razor cshtml files

后端 未结 1 1045
慢半拍i
慢半拍i 2021-01-21 23:45

e Is there any way where one can produce compile time errors if an action method is not available in the controller through using the Html.Action?

For examp

相关标签:
1条回答
  • 2021-01-22 00:32

    T4MVC is a T4 template for ASP.NET MVC apps that creates strongly typed helpers that eliminate the use of literal strings in many places.

    This does exactly what I require and removes the usage of 'magic strings' as opposed to strongly typed identifiers. Compile time errors are provided even in views if the <MvcBuildViews>true</MvcBuildViews> is set to true.

    Thanks @StuartLC for the tip!

    0 讨论(0)
提交回复
热议问题