Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

using TextTransform.exe to generate code from edmx file

I have an edmx file that I generated using edmgen2, I am using the POCO Entity Generator.tt file that Visual Studio uses or generates when I click "Add Code Generation Item" in the edmx designer.

I want to generate the cs (C#) files that Visual Studio generates (including views and stored procedures), but in command line using the TextTransform.exe.

First, is this even possible with only the edmx and tt file? if not, what's the right way to do what I'm trying to do.

If it is possible, then what's the correct syntax?

Thanks a Bunch!

like image 361
Kamal Avatar asked Sep 03 '26 10:09

Kamal


1 Answers

If I understand you correctly you have an EDMX containing the model and .TT file that generates the C# artifact.

So I made a simple experiment where I took a simple EDMX file and the OOB .TT file and ran TextTransform.exe on the .TT file. It worked fine except I had to copy the EF include file into the same folder as the .TT file.

The .TT file uses the host to resolve paths but TextTransform.exe supports this submethod of host methods as well.

For me once I found the TextTransform.exe and the EF include file it was as easy as this to generate the C# artifact:

TextTransform.exe Model1.tt
like image 152
Just another metaprogrammer Avatar answered Sep 05 '26 15:09

Just another metaprogrammer