Pratik Kothari
Pratik Kothari

Reputation: 2446

use a different T4 template while generating EDMX file - VS2012

In VS2012, while using Entity Framework 5.0 when you add an .EDMX file (ADO.NET Data Model) file to your project, VS uses http://visualstudiogallery.msdn.microsoft.com/da740968-02f9-42a9-9ee4-1a9a06d896a2 to generate the context and the entity classes as well.

But, I would like it to generate the code using the following template instead which generates the context, entity classes and fluent API mapping classes as well. http://visualstudiogallery.msdn.microsoft.com/5d663b99-ed3b-481d-b7bc-b947d2457e3c

Is there a way to associate this second template with the edmx file so that it automatically uses this template and not the one that comes in VS by default.

Currently, I have to manually delete the code generated by first template and then re-generate it again using the newly added template. I hope there is a cleaner way.

Upvotes: 0

Views: 1463

Answers (1)

Ladislav Mrnka
Ladislav Mrnka

Reputation: 364249

Currently, I have to manually delete the code generated by first template and then re-generate it again using the newly added template. I hope there is a cleaner way.

You just need to delete templates added by default (.tt files) and add templates you want to use.

Upvotes: 2

Related Questions