I am using entity framework DB first approach and wants to know how can i manage migrations in DB first approach. We're doing changes in database schema manually. Is there any way by which Entity Framework can apply the changes accordingly to the project.
问题:
回答1:
I guess I got confused between the code first with existing database and database first
with model.
What I understood is, after searching in different forums, Migrations are allowed only in code first approach. Code first assumes that you will never make any changes manually to the database. All the changes to the database will go through the code first migrations.
This is true for code first with an existing database as well. If you are working with code first with existing database then it assumes that after connecting the the database for first time all the changes to the database will go through the code first migration instead of manually.
When you are using Model instead of code first approach then any manual changes to the database can be migrated to the model by Update model from DataBase
option. Which can be accessed by right clicking on the model.
I hope my understanding is correct but any modifications or corrections are welcome.
回答2:
- You'll have to make the appropriate change manually
- You'll have to delete the model classes and generate them once again
EDIT:
I would recommend you to go through this: http://msdn.microsoft.com/en-us/data/jj206878.aspx