I've never understood their sick obsession with attributes. When I first started using MVC, I thought it was clever to add HttpPost, HttpDelete, etc... After using a real routing library and then bringing one into my MVC project, it just looks, well... stupid. Gone are my RPC method names. Gone are my untestable Http method -> Action routing. Gone are my magical behavior mixed in due to something in a square bracket.
There is nothing magical about attributes in C#, they are a well defined way to declaratively add meta data to your methods, and I've always found them quite useful and effective.
Here are a few links that may be insightful on how they work:
What's this real routing library you speak of? I actually just started using an Attribute Routing [1] library for my WebAPI project. I like having my routes defined on the methods that will handle them instead of hidden away in the global.
I used AttributeRouting for a fairly large ASP.NET MVC 3 project. I found it really clean and useful - I preferred having the routing information declared on the methods themselves, rather than in some generic routing table, or a single catch-all route. With this library, you don't have to explicitly define a route on every method, there are convention-based approaches, and different levels at which you can define the base route, then more specific routes as you get closer to the methods themselves.
I also used T4MVC, which may have fallen by the wayside, but that kept a lot of the "magic strings" out of the code.
Comments
I've never understood their sick obsession with attributes. When I first started using MVC, I thought it was clever to add HttpPost, HttpDelete, etc... After using a real routing library and then bringing one into my MVC project, it just looks, well... stupid. Gone are my RPC method names. Gone are my untestable Http method -> Action routing. Gone are my magical behavior mixed in due to something in a square bracket.
There is nothing magical about attributes in C#, they are a well defined way to declaratively add meta data to your methods, and I've always found them quite useful and effective.
Here are a few links that may be insightful on how they work:
http://oreilly.com/catalog/progcsharp/chapter/ch18.html
http://msdn.microsoft.com/en-us/library/aa288454%28v=vs.71%2...
http://www.codeproject.com/Articles/2933/Attributes-in-C
What's this real routing library you speak of? I actually just started using an Attribute Routing [1] library for my WebAPI project. I like having my routes defined on the methods that will handle them instead of hidden away in the global.
[1] https://github.com/mccalltd/AttributeRouting
I used AttributeRouting for a fairly large ASP.NET MVC 3 project. I found it really clean and useful - I preferred having the routing information declared on the methods themselves, rather than in some generic routing table, or a single catch-all route. With this library, you don't have to explicitly define a route on every method, there are convention-based approaches, and different levels at which you can define the base route, then more specific routes as you get closer to the methods themselves.
I also used T4MVC, which may have fallen by the wayside, but that kept a lot of the "magic strings" out of the code.
http://mvccontrib.codeplex.com/wikipage?title=T4MVC
RestfulRouting is nice
Edit: That library looks pretty good as well. It does come down to a personal preference thing.