Add scaffolding after separating Controllers-views project for asp.net MVC RC (ii.)

Source: Internet
Author: User

The previous article "scaffolding" for the asp.net MVC rc Separation Controllers-views project describes how to separate the controllers and views items and add the "scaffolding" of the MVC RC to the Controllers project. Unfortunately, the "scaffolding" function is too complete, so that the automatic creation and viewing view page will be in the current project, unless you are willing to manually transfer the file to the Views (WEB) project after each creation, the meaning of this "scaffolding" is almost lost. And, in time to transfer a view file such as. aspx, what about viewing it in the current project? This article will create a "stone" approach to address both new and viewed issues in the View page.

View viewing

Because there is no time to study the "scaffolding" of the internal mechanism (if a friend can achieve hack words are not so troublesome, hehe), so thought of a workaround: Can you add some "shortcuts" in the controller, and then look for the source file directly when viewing it? After a few attempts, it is not possible to find a direct creation of a shortcut file (. lnk).

So he made a MyMvc.Controllers.csproj idea. After some test research, we found that. The csproj file supports a <Link> tab and can play a "shortcut" effect in the VS program (details on how to set up the node are visible in the solution program and download code provided later in this article, no longer detailed here).

After a series of tests, these link files will not be compiled into MYMVC.CONTROLLERS.DLL, the ok,view problem is over, the rest of the work is done by a unified solution.

View New

Since the view in the mymvc.controllers is not a practical shortcut, then the new file obviously can not let him stay in the Mymvc.controllers project, so thought of "the great diversion of the universe"-- The new view is automatically moved to the Mymvc.web project, and the corresponding file is programmed with a "shortcut" in MyMvc.Controllers.csproj.

Final Solution--mvcscaffoldtool

Mvcscaffoldtool is the original one I used to solve the previously mentioned scaffolding creation, view file path, the same applies to other types of projects elsewhere.

Since to start from the outside, then the most direct, most automatic method is to write a program to automatically "monitor" the state in the Mymvc.controllers, when it changes automatically transfer files and processing corresponding. csproj files.

Because they rarely do winform, they churn out a:

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.