39

I have a project that I made in Asp.net with Entity Framework.

Now I want to add one or more tables in the database and one or more stored procedures. But entities not shows the new table.

How to show this?

1
  • 1
    Sorry but its very hard to understand your question. Are you using a database first approach in EF and generating the edmx from the database? Commented Jun 24, 2011 at 10:16

2 Answers 2

83

Open edmx file, right click anywhere in the modal and select "Update Model from Database" and follow the instructions and choose the desired tables and SPs.

enter image description here

Sometimes even after following these steps, your model will not get updated, close Visual Studio and restart it again. This has happened many times for me.

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

3 Comments

Make sure you hit Save once you've Updated the Model from Database. ;)
When I do this, it creates an a table in the diagram, but not the class which I need to reference the table from code.
When i try this, it gives me a lot of warnings with code 6002(i.e. says some of my tables, which any of them is not the table i want to add, do not have primary key defined) and does not add my specific table(that i select from Update Wizard). Do you have any idea how to solve that? Thanks in advance.
1

Sharique's answer is the good one. But I noticed a thing: when the Mapping Details window is active(near Error List, Output) and if you are trying to add a new Entity (right click the design surface, Add -> Entity), the popup dialog, "Add Entity" it won't show.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.