Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Upgrade EF 4 EDMX to EF 6

My application is using a database first EDMX in EF 4. I would like to upgrade everything to EF 6. After getting EF 6 with NuGet I had to make a lot of changes to my classes that are using my EF model, because namespaces have been changed in EF 6. Then I realized, that the code generated by my EDMX does also use the wrong namespaces etc. I'm not using a custom T4 so far.

How would I upgrade my existing EDMX to EF 6.

Thank you.

like image 237
SolarX Avatar asked Oct 21 '13 14:10

SolarX


1 Answers

  1. You delete your old .tt files
  2. You open your edmx file in designer mode (so you can see your model)
  3. Right click on a free space
  4. Select Add Code Generation Item
  5. In the dialog select "EF 6.x DbContext Code Generation Item" (something like this)
  6. Save your edmx and all classes will be generated for you, with the new namespaces and so on
like image 84
Rand Random Avatar answered Sep 23 '22 01:09

Rand Random