When using the EF 4.x DbContext Generator template, the following file structure is created:
- Model1.Context.tt
- Model1.Context.cs
- Model1.tt
- Model1.cs
- [entity].cs
- …
Model1.tt generates the entity classes, as described on Building an MVC 3 App with Database First and Entity Framework 4.1. But what is the purpose of Model1.cs? It has no meaningful content:
//------------------------------------------------------------------------------
// <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;
using System.Collections.Generic;
In case of old POCO T4 template this file was used for some shared code like
FixupCollection. In DbContext T4 template it probably doesn’t have real meaning but the default custom tool used to generate file from T4 template somehow expects that this file will be created (all other files our hacked in).