none
DB schema update on changing a POCO entity RRS feed

  • Question

  • Hi

    I am implementing my application data model via the use of POCO entities.

    As the application evolves, obviously the POCO entities may change over time - e.g. properties added, or removed.

    I need to be able to upgrade the existing database, based upon these 'code-first' POCO entities, to match the new POCOs. That means the old data needs to be retained and mapped to the new entity structure.

    I'm a little new to entity framework. I am assuming this is such a common thing to do, that entity framework can, or does do this, automatically - is this correct and what is the best location to look for more information?

    Thanks

    Saturday, June 2, 2012 9:14 AM

Answers

  • Hi Markos101;

    To your question, "I am assuming this is such a common thing to do, that entity framework can, or does do this, automatically - is this correct and what is the best location to look for more information?", Actually this was not supported until version 4.3 of Entity Framework. So if you are not using EF 4.3 this is not possible. The following two links show how to use this functionality. 

    EF 4.3 Code-Based Migrations Walkthrough

    EF 4.3 Automatic Migrations Walkthrough

      


    Fernando (MCSD)

    If a post answers your question, please click "Mark As Answer" on that post and "Mark as Helpful".

    Saturday, June 2, 2012 1:13 PM