Search code examples
sql-serverasp.net-mvc-3entity-framework-4

Database First Entity Framework Update Model is not working: What can be the reason?


I have an existing MVC 3 application using entity framework 4. The model was generated using a Database-First Mode. I have also "automatic code generation" that generate the class.

Today, I did a simple modification to my database. A field went from "int" to "float". I went to the .edmx, did a right-click, Update model from database...

But when I look at the field, it didn't change at all. I double-check everything,and the database is modified, but the model never change... Does it mean I need to do this by hand?

I remember that I did a couple of update before (like 2 months ago) and it seems to work at the time... What can be broken that I need to check?

EDIT

When looking at the edmx diff file in subversion, the change seems to be done but when looking at it in "graphical mode", the change is not there. Also, no generated code is updated.

-          <Property Name="PreparationTime" Type="int" Nullable="false" />
+          <Property Name="PreparationTime" Type="float" Nullable="false" />

Solution

  • This is the normal behavior. ;-)

    Your conceptual model will not change if you just modify something DB side, even if you perform the "Update model from database" wizard. Please have a look at this SO answer where I explain how an EDMX is built and how it should evolve.