Entity Framework Tools – Refreshing model with schema changes

image One of the main problems with Linq to SQL was the fact that you couldn’t easily refresh your diagram to take into account schema changes.

I was really pleased to see that in the Entity Framework tools they have the ability to update model from database.  Simply right click the NorthwindModel.Store in the Model Browser and click the option to update.

You then have the ability to Add, Update or Delete items from your model.

image

However, not all is same it seems….

I created a model with all the tables from my database. I then later went back and removed all the entities apart from Customer, Order and Order_Details. After selecting to update my model, I unticked the Add checkbox as I didn’t want anything being added.  I then wanted to uncheck the other tables which I wasn’t interested in but got the error “Items for update and delete cannot be checked or unchecked”, this was a bit odd but fair enough.

So I clicked finish and it added all of the removed entities back into my model!  Not what I expected to happen at all.

To make matters worse, the column I dropped was still in my table! I tried to add a column and that didn’t appear either until I deleted and re-added the table.

Anyone have any ideas on the expected behaviour of this feature??

One thought on “Entity Framework Tools – Refreshing model with schema changes”

Leave a Reply

Your email address will not be published. Required fields are marked *