ASP. net mvc using T4

Source: Internet
Author: User

When adding controllers and views to a project, ASP. net mvc uses the T4 Text Template conversion Toolkit and Text Template Transformation Toolkit) to generate code. T4 is a highly customized template-based text generator.

One of the features of ASP. net mvc previously announced by Scott Guthrie is to use T4 to generate code. The code is generated by the T4 engine based on the Text Template. This means that anyone can create or modify such a template to fully control the generated code.

A T4 template combines plain text blocks and logic control, and looks very similar to other Web Form pages. Abhishek Mishra provides a detailed example of editing a template.

Editing T4 templates in Visual Studio cannot be intelligently supported. However, Clarius Consulting provides a T4 editor community edition that can be integrated with VS and provide syntax highlighting. They also provide Professional Edition, including real smart sensing support; and T4 code generator version, supporting custom T4 hosting environments WSSF, ASP. net mvc), Server Explorer integration, XML and XSD file dragging, user-friendly database metadata retrieval API, and other functions.

T4 can be used to automatically generate any types of and target text files. Scott Hanselman provides an example: Use a template to generate the LINQ to SQL code. Scott recommends using T4 to complete various repetitive text generation tasks, even if they are consistent. NET has nothing to do: "If you need to manually repeat the same thing multiple times in the company, let it automatically generate it."

  1. Introduction to ASP. net mvc Framework
  2. Introduction to MvcAjaxPanel in ASP. NET MVC
  3. ASP. net mvc Framework to save UpdatePanel
  4. Use ASP. net mvc source code to find a solution
  5. ActionInvoker of ASP. net mvc Framework

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.