Add EF 6.x EntityObject Generator in Visual Studio 2017

entity-framework-6 objectcontext visual-studio-2017

Question

We want to upgrade to Visual Studio 2017. We utilise the Extension for EntityObject Generator for our Entity Framework 6 edmx file to construct the required ObjectContext.

This extension is only compatible with Visual Studio 2013 and VS 2015 (inofficially). The VS2017 issue does not seem to be resolved by merely modifying the manifest file in the vsix, I believe in part due to changes made to the vsix architecture.

Is there an alternative to utilising an earlier version of Visual Studio to get the ObjectContext template? For each edmx file, I presume the template is different, therefore it would be possible to duplicate it from an existing project.

1
2
9/15/2017 1:50:31 PM

Popular Answer

In VS2017, I recently completed this.

Download the Microsoft "EF 6.x EntityObject Generator for C#" extension package for Visual Studio. A *.VSIX file was used. Give it the name ZIP. You may locate another zip file within the opened zip file. You may view a TT file there. Duplicate it.

Simply replace the MyModel.TT file that creates DbSet in your project with the one you obtained from the vsix file.

Change one line:

    SourceCsdlPath = @"$edmxInputFile$",

in your

    SourceCsdlPath = @"myEDM.emdx",

Your c# model code is created with outdated EntityObjects when you save the TT file.

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