Entity Framework 6.x: Customize Fluent API in Code First to an Existing Database -


i have installed entityframework.codetemplates (as replacement used entity framework power tools) , struggling customize t4 runtime scripts files entitytype.cs.t4 , context.cs.t4 (executed when adding new "ado.net entity data model" project , selecting "code first database"). instance customize fluent api code generation , change instance property names in ef entities, different column names mapped tables (which default).

... modelbuilder.entity<department>()      .property(t => t.name)      .hascolumnname("departmentname"); ... 

another customizations need able change entity name (to different mapped table name), or change names of different navigation properties between tables:

... modelbuilder.entity<department>()   .hasmany(e => e.navigationpropertyname) ... 

the default code generation of fluent api code occurs through methodchain() helper methods, called @ different parts of context.cs.t4 runtime script. stuck customization of t4 scripts, did not found samples how add additional fluent api code default generated fluent api code in methodchain(). can post samples how kind of customizations done ?


Comments