Add EF 6.x EntityObject Generator in Visual Studio 2017

1.5k views Asked by At

We are planning to switch to Visual Studio 2017. For our Entity Framework 6 edmx file we use the EntityObject Generator extension to create us the desired ObjectContext.

This extension is only compatible up to VS2013 - inofficially up to VS2015. The solution to simply adjust the manifest file in the vsix does not seem to work for VS2017 though - I guess among others because the vsix architecture changed.

Is there a way to get the ObjectContext template without using an old Visual Studio? I assume the template is not always the same for each edmx file so it could simply be copy pasted from an existing project.

1

There are 1 answers

0
Lava On

I just did this in VS2017.

Download the VS extension package "EF 6.x EntityObject Generator for C#" from MS. It's a *.VSIX file. Rename it to ZIP. open the zip file and inside that you find one more zip. There you will see a TT file. Copy it out.

In your project that have a MyModel.TT file that generates DbSet just replace that TT file with the one you got from vsix file.

Edit one line:

    SourceCsdlPath = @"$edmxInputFile$",

to your

    SourceCsdlPath = @"myEDM.emdx",

save TT file and your c# model code is generated with old EntityObjects