Search code examples
asp.net-mvc-5scaffolding

MVC 5 Scaffolding still uses old model when the model is updated


I'm using MVC 5, EF 6 Database first and scaffolding

I created an Entity Data Model then generated controller using scaffolding

Then I needed to change some field on the database. I deleted the model which I'd changed (since EF only check for new thing in database, It will not update anything if I don't delete the model)

I deleted the generated files and generated it again, but it still used old data model to generate my controller.

I tried with new model (never generate controller before), didn't work.

Do you have any suggestion? or the way I update the model is wrong?

Thank you.


Solution

  • When you update your model, you need to rebuild your project, then only new model is available.