Search code examples
c#asp.net-mvcentity-frameworkentity-framework-6.1

How to update EF models when using DB Code first?


I have added added Entity Framework to my project and selected Code first from database when creating my models. But the problem is, i couln't find how find how to update existing models and add new models to my project when i make changes on database.


Solution

  • It is very straightforward. Switch on migrations, change/add you classes, create a migration and update your database. See here for example. There are plenty of other sources.