I really enjoyed the idea to use Attributes to control ASP.NET MVC routing, so instead of registering a new route and polute Global.asax.cs or *AreaRegistration.cs, I have something like this:
[Route("users/{userrId}/pages/{pageId}"]
public ActionResult Some(int userId, int pageId) { }
I see the great answer: ASP.NET MVC Routing Via Method Attributes, but I would like to get some "real-use" recommendations.
.. and is it really worth to use that, can it be treated as best (perhaps good?) practice?
I did try routing via method attributes while ago. Wouldn't use any framework for routing.
I think it's best to just follow "standard" scheme.
Also - unit testing each route individually helped me quite a lot
(I even wrote test that fails in case I've missed any route).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With