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 8610135
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T04:03:26+00:00 2026-06-12T04:03:26+00:00

I am using MVC3 with EF5. I like the way I get scaffold generated

  • 0

I am using MVC3 with EF5. I like the way I get scaffold generated Controllers and Views. This produces a nice workflow to create an application quickly and consistently. Of course the initial idea behind Scaffolding was to create a 80% quick start, and obviously the Controllers and Views get quickly customised. However are there any recommended practices for retaining custom code while still being able to rerun the scaffolding. The nearest I can think of is having external method calls from the controller actions etc.. I guess I would then need to incorporate these into the T4 templates??? Perhaps Dependency Injection has a role here? I have seen it used in the Domain Layer for extra service methods.

Perhaps I am hoping for too much !!!

Many thanks for any ideas.

  • 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-06-12T04:03:28+00:00Added an answer on June 12, 2026 at 4:03 am

    Using auto-generated code for controllers, just make sure the code generated creates partial classes.

    As for views, it much more difficult (some times impossible) to change a view and have it re-generated without losing what you needed after you changed it.

    Updated

    You could have your code generator create files like:

    Controllers/ClientController.Auto.cs (Auto added to denote auto generated)

    //------------------------------------------------------------------------------
    // <auto-generated>
    // This code was generated from a template.
    //
    // Manual changes to this file may cause unexpected behavior in your application.
    // Manual changes to this file will be overwritten if the code is regenerated.
    // </auto-generated>
    //------------------------------------------------------------------------------
    
    using System;
    
    namespace SomeCompany.SomeProjectName.Controllers
    {
      public partial class ClientController
      {
        public SomeAutoGeneratedMethod()
        {
        }
    
        public SomeAutoGeneratedProperty { get; set; }
      }
    }
    

    Controllers/ClientController.cs

    using System;
    
    namespace SomeCompany.SomeProjectName.Controllers
    {
      public partial class ClientController
      {
        public SomeProgrammerWrittenMethod()
        {
        }
    
        public SomeProgrammerWrittenProperty { get; set; }
      }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm using MVC3 and I have a model like this: public class Foo {
I just started using MVC3. I am using fields like this: <div class=editor-field> @Html.TextBoxFor(model
I'm using MVC3 and I would like to make my views be fully integrated
I'm using MVC3's Razor engine to generate views and have the following line of
Using MVC3 for the first time, so sorry for the noob-like question. I'm trying
using MVC3, Code First (DbContext) Is there a way to implement (ideally) a facade
I'm using MVC3 razor and in Views folder I have 4 folder: Shared _Layout.cshtml
I'm using MVC3 to build a web application. In this application I have an
I have not been using MVC3 for that long and think this is a
Using MVC3 I have this in my controller. How do I enumerate this within

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.