Add EF 6.x EntityObject Generator in Visual Studio 2017

entity-framework-6 objectcontext visual-studio-2017

Question

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
2
9/15/2017 1:50:31 PM

Popular Answer

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

2
6/26/2018 12:20:52 PM


Related Questions





Related

Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow
Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow