mvc entity framework

ITsolutionWizard used Ask the Experts™
i just take over a mvc with entity framework project and the developer is gone.
Now I added a column in the database table, and how can i refresh the entity framework so I can continue to code with linq...?

I am not expert with any projects that using entity framework. hope you can help out.

Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
It depends on whether the EF was created as database-first or code-first.
Given what you said, and assuming it was code-first, open the .edmx, right click and hit "Update Model from Database".  You can check off any new tables you want to add, but by default any existing tables will be updated with new / removed columns.
Shaun VermaakTechnical Specialist
Awarded 2017
Distinguished Expert 2018

That is database-first. Just make a backup of your models in case the previous developer added code into the autogenerated classes
Jose Gabriel Ortega CastroTop Rated Freelancer on MS Technologies
Awarded 2018
Distinguished Expert 2018

Go to the Powershell console.
Open VS and navigate to Tools/Package Manager Console
Then run Enable-Migrations (if you got an error, your developer already did this)

if the enable-migrations cmdlet works or fail you should create a new migration (from old DB to new)
add-migration UpdatedCoumnXXXX

you should review the code proposed and if you accept it just run


and that's it.

This is if you added the column programmatically if you did it on the DB follow the previous suggestion from  @Shaun Vermaak

Documentation in here:

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial