I am currently working on a project where I want to use the Entity Framework for the first time. I read much information in the books of Lerman/Miller, in MSDN, the ADO.NET blog and here on stackoverflow about the most recent developments regarding the DbContext API and the Code First Migrations capabilities available since EF 4.3. Since especially the latter are really great, I wondered whether in the meantime it is possible to do the same working "Model First" centered? Is it possible to do migrations based on the visual EDMX designer (instead of the code) after creating the code and the database from it?
I found a pretty recent link (2012-04) saying that it is not (in EF 4.3): Using EF4 migration tool with model-first approach
Secondly, I found information that old code and database tables are overwritten when trying to regenerate them from the EDMX designer?
But the info I refer to is about the Power Tools: http://blogs.msdn.com/b/adonet/archive/2012/04/09/ef-power-tools-beta-2-available.aspx
Reverse Engineer Code First This command allows one-time generation of Code First mappings for an existing database. [..] • Running this command multiple times will overwrite any previously generated files, including any changes that have been made to generated files
Is this restriction only specific to the Power Tools Reverse Engineer Code First or does it expand to the EDMX designer in general, especially the "Model First" approach, too?
Furthermore, in the above article I found:
View Entity Data Model (Read-only) Displays the Code First model in the Entity Framework designer. • This is a read-only representation of the model; you cannot update the Code First model using the designer.
And the same question applies here.
So is there currently a way with full round-trip modelling without data-loss (code and database) and keeping the EDMX file writable, preferrable following "Model First"?
From which verson of EF on is this (already or planned to be) supported, which version of .NET should I target then (4.0 sufficient?) and will this work with Visual Studio 2010 Professional? Could you give a rough estimate for the date you may will have implemented this?
This would of course be awesome and a huge breakthrough! I think I can only roughly imagine how much work this would be and am aware that you are fully working at your limit already. I want to thank you for your great work so far and encourage you to keep it up.
If I understand your question correctly you are after Migrations for the EF Designer (i.e. update the model in the designer and have the database incrementally changed). This isn’t currently supported, it is on our backlog to address but we don’t have specific plans for a particular release. One of the things we need to work out is whether we should just integrate/extend the existing Code First Migrations feature to work with the EF Designer or whether we need something that is a bit more designer focused. Obviously things can change, but at this stage I wouldn’t be expecting us to start working on this feature in the next 6 months. Beyond that it’s going to depend on what features we see folks asking for… so I would create a new feature on http://data.uservoice.com and get folks voting on it. ~Rowan