Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ASP.NET MVC custom T4 templates for views

When I'm adding a new strongly-typed view to an ASP.NET MVC project, I can select between different view content templates (Create Details, Edit, List). I have read these are templates based on the Visual Studio T4 code generation engine.

How can I author and configure my own templates and let them appear in the available templates when adding a new view?

like image 538
kay.herzam Avatar asked Jun 17 '09 19:06

kay.herzam


People also ask

What is the purpose of using T4 templates?

Design-time T4 text templates let you generate program code and other files in your Visual Studio project.

What are T4 templates in Entity Framework?

T4 templates in entity framework are used to generate C# or VB entity classes from EDMX files. Visual Studio 2013 or 2012 provides two templates- EntityObject Generator and DBContext Generator for creating C# or VB entity classes. The additional templates are also available for download.

What is T4MVC?

T4MVC is a T4 template for ASP.NET MVC apps that creates strongly typed helpers that eliminate the use of literal strings in many places.

What are scaffold templates in MVC?

Scaffold templates are used to generate code for basic CRUD operations within your ASP.NET MVC applications against your database with the help Entity Framework. These templates use the Visual Studio T4 templating system to generate views for basic CRUD operations with the help of Entity Framework.


1 Answers

ASP.Net MVC - T4 Fun

T4 Templates: A Quick-Start Guide for ASP.NET MVC Developers

like image 154
Fredou Avatar answered Oct 14 '22 03:10

Fredou