Get used to the layered structure. NET developed, of course, also has the advantage of stratification, so in the use of monorail to build the site, the first consideration is how monorail to deal with layered structure.
Problem 1:monorail There is no root directory at the Web layer, there must be a directory of views
Monorail MVC does not have a root directory structure, that is, it can only access a level two directory, such as http://www.pumaboyd.com/views\/*, and everything else is under the view directory. At first I thought it was a very serious problem and it was very restrictive. Later in the Firstyi article introduction can be configured to the root directory, this has the confidence to continue to look down. In the end you will find that the problem can be solved by routing. And I still feel the best way to routing.
You can also change the default views directory, which can be configured via Webconfig
<viewengine viewpathroot= "wap3″customengine=" Castle.MonoRail.Framework.Views.NVelocity.NVelocityViewEngine, Castle.MonoRail.Framework.Views.NVelocity "/>
So the default directory becomes WAP3.
The CS file that corresponds to the problem 2:controller.
If it is the default, then he will be in the Controllers directory, and this is what I do not want to see. So the entire web layer, and the DLL. So we need to configure to a separate layer (in a separate project)
Add Standalone project, similar configuration in Webconfig
<assembly>WebHome.Control</assembly>
and support for multiple controllers. Depending on your project use, if needed can be sliced finer.
<assembly>WebHome.Control</assembly>
<assembly>WebHome.Control1</assembly><assembly>WebHome.Control2</assembly>
As for the remaining service, the BLL, the DAC layer and the original structure has not changed much. In fact, it feels like the end is to split the current web layer into V and C.
The demo chart (the picture is always better than the text in the expressive structure.) )
- Webhome is the page, which is the MVC V
- Controls is the display control class of the page, that is, MVC C
- SERVICE&DAC is the specific page logic and data access layer (whether it's MVC m I don't think it's the right thing, I feel like I'm fading M concept)
- Component is the component of the page, which is equivalent to WebControl