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.

 

ABOUT CARL DE SOUZA

Carl de Souza is a developer and architect focusing on Microsoft Dynamics 365, Power BI, Azure, and AI.

carldesouza.comLinkedIn Twitter | YouTube

 

Leave a Reply

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