Page 1 of 1
Entity Developer migrations
Posted: Mon 23 Nov 2015 13:56
by Zero-G.
Hey
I wanted to know, what the best way is to use migrations with Code first?!?
When I do have an existing EDML file and there I add a new class through the designer.
How will the Migration be handled? - Or do I have to do this by Hand? (Doing it twice, once within the designer and once writing the migrations up and down(s)?)
Hope you can give me some informations or maybe you could provide me a sample Project!?
THX
Re: Entity Developer migrations
Posted: Tue 24 Nov 2015 10:48
by Shalex
There are two alternative ways for synchronizing your model with the database:
1) update your database in Entity Developer via right click the designer surface > Update Database From Model
2) use
Code First Migrations
If this doesn't help, please clarify the question and specify the way (1 or 2) you are using.
Re: Entity Developer migrations
Posted: Tue 24 Nov 2015 11:47
by Zero-G.
Hey
Thanks for your answer.
Here is, my way of work (and probably a Suggestion for an upcoming release)
I started with Code first aproach. But by using your graphical Environment EntityDeveloper.
As you said, within the tool I do have the Option to update the database.
But when I roll my program out to my customers, I don't have this Option. - So I have to update the database by Code.
When I do the Code First Aproach provided by Microsoft, then it works fine, but with the end result, that I can't see the changes within Entity Developer. - So I have to do the changes twice.
1) Within the Entity Framework
2) Writing the Code first changes by Hand.
This isn't a clean way.
As Workaround I could Change the tables within Entity Developer and let me create a script of changes and run this script through my Clients database on update.
But then, the strong typing aproach from Code first isn't given anymore.
Hope you understand what I try to do.
As Suggestion for an upcoming Version it would be good, to have the possibility to automatic generate a Code first Migration peace of Code.
THX
Re: Entity Developer migrations
Posted: Wed 25 Nov 2015 14:51
by Shalex
Zero-G. wrote:As Suggestion for an upcoming Version it would be good, to have the possibility to automatic generate a Code first Migration peace of Code.
Thank you for the suggestion.