views:

101

answers:

1

I have been using some customized MVC templates that really improve my productivity. However, I would like to take it to the next level.

I generate a controller template for each table in my app. The controller has Edit, List, Details, and Delete actions. What I would like to do, is at the same time trigger the generation of the views for those actions.

Does anyone have a reference or have suggestions on how this can be done?

+2  A: 

It is not easy to generate multiple files from a single T4 template, but it can be done. A good tutorial is here.

Gabe Moothart
I will try this in the next couple days.
DrydenMaker
I am having trouble getting include directive to work with the MVC. According to this http://www.lostechies.com/blogs/hex/archive/2009/02/05/trying-to-extend-the-asp-net-mvc-t4-item-templates-to-create-multiple-files.aspx MVC templates were unable to use includes. I wonder if it still (if not directly) is with MVC2, which is what I am using.
DrydenMaker
This did help. What I really wanted to do is to modify the MVC templates to do this. However there are some limitations within the MVC Env. Your tutorial really helped and I am going to make a completely custom T4 template for generating my generic code. Thank you.
DrydenMaker