Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to Rename DBContext in Entity Framework 6

I had an issue with EF not pulling in the Foreign Key relationships when doing an Update Model From Database. So I just deleted the .edmx file and regenerated it. The problem is that my context type was named InventoryMgmtContext, and now I am getting the error

The type of namespace InventoryMgmtContext could not be found.

Where/how can you rename the context?

like image 856
crichavin Avatar asked Mar 23 '15 02:03

crichavin


1 Answers

  1. Open the EDMX diagram, right click the background, and click "Properties":

enter image description here

  1. Change the Entity Container Name value to the name you want:

enter image description here

  1. Save the EDMX.
like image 63
Chris Schiffhauer Avatar answered Oct 18 '22 10:10

Chris Schiffhauer