So I am reading about building MVC3 projects and there is one thing that seriously bugs me. The folder structure of the project in no way corresponds to the path of the HTTP request. There is a bunch of things I like and would want to use, but having a flat folder structure is not one of them.
Why is this a problem? Well, I see it becoming a problem when building a site with a heavy mix of content pages and various forms/dynamic pages (most of our sites are like that), which would typically be done by different people. It seem it would be too complicated for client-side developers to follow routing rules of dynamic pages and/or creating new ones.
What I would like to understand is if there is way to configure MVC3 application in such a way that:
- it follows directory structure for finding controllers without explicit route map for each one
- views live in the same folder as corresponding controller
- routing magic still works for actions and parameters
For instance I'd like to have a request /fus/ro/dah/
to try to find DahController
in the \webroot\fus\ro\dah\
folder and execute its Index
action. If not found it would look for RoController
with Dah
action in the \webroot\fus\ro\
folder, etc.
It is entirely possible that MVC was not meant to be working this way at all and I am just trying to force a square peg into a round hole.
UPDATE: Looks like I can drop a view file into the desired folder structure, and it will be executed. However layout would not work apparently because it is expecting a controller. Does this mean I have to create a controller for pure content pages? That is a pretty crappy design...
UPDATE 2:
Main issue right now is that creating "fus" folder means that MVC will not even attempt to look for FusController
... not under "fus" folder, nor anywhere else. Is it possible to get around that?