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.
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
来源:https://stackoverflow.com/questions/46241084/add-ef-6-x-entityobject-generator-in-visual-studio-2017