I find it ridiculous that MVC doesn't recognize a controller unless it has 'Controller' appended to the class name. This answer mentions the ControllerDescriptor
and ControllerTypeCache
as the two places in MVC where this convention is set up.
My question is why? It's clearly not a convention over configuration thing, as IsControllerType
in ControllerTypeCache
checks that the class:
- Is public
- Is not abstract
- Implementes
IController
- Ends with
"Controller"
Does anybody know the reason for this? After all controllers are likely to be in an actual MVC project, in a folder named 'Controllers', and a simple double click on the file will show us that the class inherits Controller
.
Just seems silly to me - but I was wondering if there is an actual reason they have done this.
EDIT
Just seen this blog post by Phil Haack from yesterday where he discusses the decision this convention - he is of the same mind of me - Probably a bit pointless!