For a database first design, creating the EDMX
generates the DbContext and the poco model T4 (.tt)
template files.
I am successfully able to customize the Model.tt
file to make it generate POCO classes with Pascal cased class names and property names and also the poco class file names in Pascal case which fits beter with with the coding standards of the rest of my code.
The issue I am trying to tackle is, I have to edit the Model.tt
files for every EDMX
when I create one, rather I am trying to see if there any way to customize the tt file generator and add the code modification to it so that the pascalcasing rule gets implemented automatically when creating an EDMX
.
I am not sure if this is possible. Please suggest.
You can customize Visual Studio item templates for entity framework. Then each edmx that you add to the project using
Add New Item
window, choosingADO.NET Entity Data Model
, will use modified templates.For example, for
C#
language and locale1033
andEF6
, The templates are stored at:And the files are:
CSharpDbContext.Context.tt
CSharpDbContext.Types.tt
For more information: