Entity Framework 6.4.4 is unable to generate Entity Classes from EDMX through 'Run Custom Tool' option. Visual Studio 2022

221 views Asked by At

I have created two tabled in the database and I was able to add them to the Edmx by updating the model from the database, however, the entity classes for the tables that should've been generated are missing.

What I have tried?

I have tried clicking Run Customer Tool option by right clicking the the Edmx file but it did not produce any entity class which I was expecting. Moreover, the Run Custom Tool is only appearing when I right click the Edmx file and it is missing when I right click the .tt one.

On some answers I read that there was an open bug which is now fixed and so I have updated the Visual Studio to the latest version which is 17.7.4, however, it did not make any difference.

I am using EntityFramework 6.4.4 and I do not want to manually write the entity file as all current entity files were automatically generated.

The Edmx Model is successfully updated from the database and I can see the table in the design view, but there are no entity classes.

Visual Studio 17.7.4
Entity Framework 6.4.4
.NET Framework 4.8.1

What can I do to fix it this issue?

1

There are 1 answers

0
Node defender On

Based on the issue raised, I conducted tests and found that if an entity class has been added to edmx, but the previous edmx is updated to add another entity class, the following situation will occur:

Entities in Diagram can be added normally, but entities in Solution Explorer are not generated normally. For example, my edmx has three entity classes: Person, Class, and Room. At this time, I added a new Activity table in the database and updated it in edmx, but the following situation occurred: Activity does not appear in Solution Explorer

enter image description here

enter image description here

But at this time, you only need to right-click the project, click Rebuild, and Activity will appear in Solution Explorer.

enter image description here

enter image description here