1

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.

Community
  • 1
  • 1
juniper
  • 311
  • 5
  • 13
  • possible duplicate of [Entity Framework 4 - Update database schema from model. Without wiping the table data](http://stackoverflow.com/questions/3144117/entity-framework-4-update-database-schema-from-model-without-wiping-the-table) – Craig Stuntz Jul 10 '12 at 14:33
  • Thank you for the pointer, which is a good summary of the pieces I already mentioned in my question. However, it only covers the database part of my question. I wanted to know, whether it is possible to do full roundtrip model designer centric entity design updating the database AND the code (ideally including POCO). So the focus here is wider. Furthermore I explicitly asked for advancements since 4.3 and whether - and if so, for when - it is planned by the EF team to implement this approach. – juniper Jul 11 '12 at 06:41

1 Answers1

2

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

divega
  • 6,320
  • 1
  • 31
  • 31
Rowan Miller
  • 2,090
  • 15
  • 15
  • "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)." Answer: Yes, Migrations based on the EF Designer, incrementally changing BOTH, the database and the classes in the code, too. (sorry, could not make stackoverflows quoting work in this comment) – juniper Jul 22 '12 at 19:46
  • 1
    "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." - juniper: Yes, I roughly thought about that already, too. My feeling here is that the second route could be better (because - or despite? - ER models are always richer than can be directly mirrored by the class model in most OO-languages). But of course it is difficult that the two generated models (database and code) match each other and do not diverge. – juniper Jul 22 '12 at 19:51
  • Thank you for fully clarifying my questions and I will see to create the feature request.Thank you for fully clarifying my questions and I will see to create the feature request. – juniper Jul 22 '12 at 19:52