Adding Object to EF Model Does Not Display Object

Leave a comment

When using the Entity Framework, such as in an ASP.NET MVC application, you may find the model is empty after choosing database objects:

Adding new objects using “Add existing entities and relationships to this diagram by dragging them from the Model Browser” does not add the objects.

One cause for this is that a primary key has not been defined in the table or view you are trying to use in the model.

To resolve this, add a primary key to your table. Then, update the model:

Reselect the table/view and you will see it in your model.

 

Carl de Souza
Keep learning. Keep building.

Explore AI, agents & Microsoft technology.

I share practical ideas, tutorials, and videos about AI, AI agents, Microsoft technologies, and the Power Platform.

Subscribe on YouTube →
Carl de Souza Enterprise Architect at Microsoft · AI Technology Expert

Leave a Reply

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