Update the model

Image

Have you thought about what you expect to happen? Let’s try it out and see if you were right:

Image

In the Entity Model Designer, right-click on a blank area of the design surface and choose Update Model from Database...

The wizard will open on a screen with three tabs, and the Add tab will be displayed. You can use this tab to add database objects to your model after it has been created.

We’ll do that in the next section of this chapter, but not right now, so select the Refresh tab.

Image
Image

You can’t make changes on the Refresh tab. Visual Studio is going to update every object that has changed in the database (assuming that you’ve already included the object in the model).

Are you surprised at the number of tables to be updated, even though we only updated one? That’s because of the way all the tables are related. When we made a change to the Recipe table, Visual Studio decided that every table that’s related (directly or indirectly) to it needs to be updated.

You can’t make changes on the Delete tab either, but the IngredientWeights table that we deleted from the database is listed here.

Click Finish to exit the wizard and update the model.

Image
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset