English
Français

Blog of Denis VOITURON

for a better .NET world

How to migrate EntityFramework 5 to EntityFramework 6 with Visual Studio 2015

Posted on 2015-09-08

If you have developed your application with EntityFramework 4 or 5, using the graphical model designer EDMX… May be you received a compilation error after some updates of this EDMX. Why ? Because the model is different with EF6. See this Microsoft Magazine article for more information: https://msdn.microsoft.com/en-us/magazine/dn532202.aspx.

The solution is described in the new file generated by the new EF Visual Studio Wizard: T4 code generation is enabled for your model. To enable legacy code generation, change the value of the ‘Code Generation Strategy’ designer property to ‘Legacy ObjectContext’. This property is available in the Properties Window when the model is open in the designer.

So, you need to update your EDMX, to delete new generated files (below .tt files), change the property Code Generation Strategy to Legacy ObjectContext and save your EDMX to re-generate all classes.

Watch this short video to a full example.

 

Languages

EnglishEnglish
FrenchFrançais

Follow me

Recent posts