Using Visual Studio 2019 I recently upgraded all my NuGet packages, so I see that EntityFramework is now showing as 6.2.0. My project is a Web API 2 solution. When I open my database model and right-click to Update Model from Database I can select my new tables but when I save the edmx file it closes immediately. In the past it would run for a bit while it wrote new files.
In the actual .edmx
file itself for example I see this entry for my newly added table:
<EntityType Name="Audit_Log">
<Key>
<PropertyRef Name="id" />
</Key>
<Property Name="id" Type="int" StoreGeneratedPattern="Identity" Nullable="false" />
<Property Name="Lab_Space_Id" Type="int" Nullable="false" />
<Property Name="Field" Type="varchar" MaxLength="80" Nullable="false" />
<Property Name="Old_Value" Type="varchar" MaxLength="1000" />
<Property Name="New_Value" Type="varchar" MaxLength="1000" />
<Property Name="Modified" Type="datetime2" Precision="7" Nullable="false" />
<Property Name="Updater" Type="int" Nullable="false" />
</EntityType>
However, it didn't generate the corresponding class definition for the Audit_Log class. If I completely remove the edmx file and select all my desired tables plus this new one it will generate it correctly.
This is a workaround for the problem. If you expand the .edmx
file in Solution Explorer you'll see two files that end in .tt
. Right-click on those and choose to Run Custom Tool and then the classes will be generated. Just doing it on the .edmx
file itself didn't work for me.