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.
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)
Controllers/ClientController.cs