crichavin
crichavin

Reputation: 4572

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?

Upvotes: 16

Views: 10106

Answers (1)

Chris Schiffhauer
Chris Schiffhauer

Reputation: 17300

  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.

Upvotes: 35

Related Questions