This tip will prevent us from having to manipulate strings. Therefore :
- It reduces mistakes in controller/action names and
- It allows to type strongly parameters (and convert if needed) that will be add to
- It makes refactoring and renaming operations easier and safer.
Add MvcAction Class
We will implement a
MvcAction class containing the information needed to point to an action.
Add extension methods for UrlHelper and HtmlHelper
We then add extension methods for
HtmlHelper to support
We create static class ControllerUrlHelper for each Controller to centralized MVC action :
(In this case for
Example of use :
In layout main menu