1

I have EF where I added new tables like "Update Model from database" and saved ,but the tables are not created in either Context.cs file or into models. I closed Visual studio and restarted again, but still , I get the same problem. Is this a known and existing bug?

0

2 Answers 2

1

If you click Update model from database you get a window with a TabControl in it. The tab items are Add, Refresh and Delete. From the Add tab check from the treeview the tables that you want to add. Then those selected tables are inserted into the edmx file

Sign up to request clarification or add additional context in comments.

4 Comments

this will not add in to context.cs and in to model. Have you tried in that way??
Are the tables present in the edmx file? If yes then click Build>Transform All T4 Templates
i am not finding that step like Build>Transform All T4 Templates , and yes i can see it in edmx files
Should be there, but you can assign a Keyboard shortcut. Tools>Options>Environment>Keyboard Type Template in the search box, select Build.TransformAllT4Templates enter a shortcut e.e (CTRL+ALT+4,T) click assign, click OK. And then press the shortcut.
1

To update the .edmx file when the database changes

In the Model Browser, right-click the .edmx file and select Update Model from Database.

The Update Model Wizard starts. If there is no database connection specified, the Choose Your Database Connection dialog box appears. Otherwise, the Choose Your Database Objects dialog box appears.

If the Choose Your Database Connection dialog box appears, specify a database connection. Otherwise, go to the next step.

For details about specifying a connection, see Choose Your Data Connection Dialog Box (Entity Data Model Wizard). When you have specified the connection, click Next to display the Choose Your Database Objects dialog box.

Click the Add tab.

Nodes for tables, views, and stored procedures are displayed. If any objects have been added to the database (or were not included in the previous storage model), you can expand the corresponding node to view the objects that are available to add to the conceptual model.

Note If an object has been deleted from the conceptual model but has not also been deleted from the storage model, the object will not be available to add to the conceptual model. For more information, see How to: Delete Objects from the Storage Model (Entity Data Model Tools).

Expand the Tables, Views, and Stored Procedures nodes, and check the objects you want to add to the .edmx file.

Click the Refresh tab.

Nodes for tables, views, and stored procedures that are included in the existing storage model are displayed. Any changes that have been made to these database objects will be reflected in the updated storage model. Changes to the conceptual model are made when columns are added to a table or view.

Click the Delete tab.

Nodes for tables, views, and stored procedures are displayed. If an object has been deleted from the database and was included in the previous storage model, you can expand the corresponding node. The objects in these nodes will be deleted from the updated model.

Click Finish to update the .edmx file with the database changes.

Find the complete reference here: Update Entity Data Model

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.