0

Is there a way to avoid a refresh of each entity in the entitymodel on model refresh.

For example we have a database with an order and invoice table. Both tables are mapped to entities in the entity model.

During development we modify the order table in database with a new field. Is there a way / tool to only refresh the order entity when refreshing the EDMX ?

We're using EF4 on .NET 4.0 with database first approach.

Thanks in advance

Jorik
  • 3
  • 3

2 Answers2

0

As answered here Updating your edmx to reflect changes made in your db (.net linq-to-entities) :-

Update/delete from the EDMX is not always functional. If the model doesn't get updated on clicking Update Model from Database let's say when you have updated a view/table in the DB, do the following:

1) Delete the view/table from the model diagram
2) Switch the EDMX to xml view (right click the edmx file and select "Open With")
3) Search and delete the xml entity elements
4) Switch back to EDMX view

5) Click Update Model from Database

This should reflect any kind of change you made to the DB to your EDMX. It's cumbersome, but works flawlessly.

In an ideal world, i would expect the Update Model from Database to sync the changes from DB to EDMX. But, it doesn't work most of the time.

Community
  • 1
  • 1
Neel
  • 11,625
  • 3
  • 43
  • 61
  • 1/2 So practical, what you say is that: I add a new field to my order table in database. Then I go to the edmx and delete the entity from the diagram. Then I open the edmx in xml view and delete all entity elements of Order. Finnaly I update the model from database through the updatemodel wizard and select the table in the add tab. – Jorik Jul 16 '14 at 09:49
  • 2/2 The problem is that at the same time my collegue has modified an other table in database, for instance he added a new field to the table invoice. When i click update model from database i also update the invoice entity. Even if i only selected to add the order table in the updatemodel wizard. – Jorik Jul 16 '14 at 09:50
0

You can update the EDMX xml manually, but you need to understand the entire structure of it

Saito
  • 694
  • 7
  • 25