Context mismatch after Update-Database RRS feed

  • Question

  • Hi everyone,
    Currently we are working on a big project concerning a quality control system for university courses.
    As backend we are using a Code First database (SQL Server 2005) to store the entities.

    The initial development workflow was to invoke a Recreate Database which effectively dropped the database and recreated it again using the Context operations. As we probably all agree, this workflow is not acceptable in Staging/Live environments.

    Luckily the EntityFramework.SqlMigrations have been released recently, allowing us to invoke the update-database command.

    However when the command completes successfully, the Context still throws an error stating that the backend model has changed.

    Anyone having the similar problems? Help is welcome!

    ~Kevin van Blokland

    Monday, August 29, 2011 10:18 AM


  • Hello,

    SqlMigrations were not released recently. It is just technology preview and it licensing agreement says:


    ·         You may install and use any number of copies of the software on your premises to test how it runs with your programs.

    ·         You may not test the software in a live operating environment unless Microsoft permits you to do so under another agreement.


    So be aware that using it for production environment is violating these license terms. You will not get any support and in case of any disaster you don't have any warranty and you will not get any remedy. Because it is not a final version it can have many bugs and it doesn't have to work in some scenarios at all. So are you sure that you did changes which can be recognized by migrations?

    If you have your local copy of the database you can also try to access EdmMetadata table and delete the record it contains. It should force your application to skip version check but it will fail later if your model is inconsistent with the database.

    Best regards,

    • Marked as answer by Jackie-Sun Monday, September 5, 2011 6:21 AM
    Monday, August 29, 2011 12:05 PM