Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6879687
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T04:52:40+00:00 2026-05-27T04:52:40+00:00

Say I have the following models: public class Item { public int Id{ get;

  • 0

Say I have the following models:

public class Item
{
    public int Id{ get; set; }
    public ItemDescription ItemDescription{ get; set; }
}
public class ItemDescription
{
    public int Id{ get; set; }
    public int Revision{ get; set; }
    public string Test{ get; set; }
}

I run the following in the package-manager:

Scaffold Controller Item

to generate some views and stuff… but it appears that the scaffolder ignores any complex/non-scalar data types and consequently generates views that are of little use.

I am wondering if it is possible to instruct the scaffolder to be a little more intelligent about things. Here’s what I would like to happen:

  • scaffolder creates Editor/Display templates in the shared folder
  • uses EditorFor to leverage these templates

All the code to make this happen seems to be generated by the scaffolder, but is structured in a way that surprises me, with _CreateOrEdit.cshtml “templates” generated in the folder associated with the view. To me, this suggests that the scaffolder generates code that would not be ideally suited to a more recursive way of generating views for models.

Are my expectations way off, or am I missing something?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T04:52:41+00:00Added an answer on May 27, 2026 at 4:52 am

    Description

    You can find the T4 Templates that Visual Studio uses to generate the Code in

    YourPathToVisualStudio2010\Common7\IDE\ItemTemplates\CSharp\Web\MVC 4\CodeTemplates

    change the templates you need to solve your problem in general. Another thing you can do is to create a template and add them to your particular project / solution.

    Check out the great Scott Hanselman – T4 (Text Template Transformation Toolkit) Code Generation – Best Kept Visual Studio Secret post.

    I really encourage you to read the links in my "more information" section.

    Have a nice day!

    Update

    Since a few days the whole (not only mvc) microsoft webstack (of love, thx scott hanselman for this term ;)) is open source on codeplex ASP.NET Webstack. Check it out!

    MVC4 is not in RTM Version, but maybe you are interested in.

    Recipes for Code Generation in Visual Studio (MVC4)

    The new Recipes feature enables Visual Studio to generate solution-specific code based on packages that you can install using NuGet. The Recipes framework makes it easy for developers to write code-generation plugins, which you can also use to replace the built-in code generators for Add Area, Add Controller, and Add View. Because recipes are deployed as NuGet packages, they can easily be checked into source control and shared with all developers on the project automatically. They are also available on a per-solution basis.

    Feel free to ask additional questions. Please use the comment feature of my answer.

    More Information

    • MSDN – Code Generation and T4 Text Templates
    • Scott Hanselman – T4 (Text Template Transformation Toolkit) Code Generation – Best Kept Visual Studio Secret
    • video mvcConf 2 – Steve Sanderson: MvcScaffolding
    • MvcScaffolding: Overriding the T4 Templates
    • MvcScaffolding: Creating custom scaffolders
    • ASP.NET Webstack
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Say I have the following models: public class Person { public string Name {
ok say i have the following model: public class bar{ public string bar {get;
Let just say I have the following data models: public class Account { public
Let's say we have the following simple model: public class Car { public int
I have the following model: public class Person { public string Name { get;
Say you have the following object: public class Address { public String Line1 {
Lets say a have the following Model public class FirstModel { public List<SecondModel> SecondModels
Lets say we have following models. class User(db.Model): username=db.StringProperty() avatar=db.ReferenceProperty() class User(db.Model): username=db.StringProperty() avatar=db.StringProperty()
Lets say we have the following models: (simplified) class Collection(models.Model): slug = models.SlugField() class
Let's say I have the following two classes: package example.model; public class Model {

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.