Question:

Should I manually change the generated code?


Answer:

You can change any files or folders in Visual Studio except the following folders which will be owned by M# and overwritten regularly.

  • Model » Entities (generated partial classes for business objects)
  • Model » DAL (generated data access classes or NHibernate mappings)
  • Website » Controllers » Pages (generated controllers)
  • Website » Controllers » Modules  (generated controllers)
  • Website » Views » Modules (generated views)
  • Website » Views » Pages (generated views)

For changing the code in any of these folders, you can add your code as extensions directly in M#, so that the next time they are regenerated, your changes appear in the output .NET code.