ghanshyam.mirani
ghanshyam.mirani

Reputation: 3101

Issue related to Updating Entity Data Model (.edmx)

I have an asp.net web Application. I have added Entity Data Model in the App_Code folder, that generates the following files :

  1. Model.Context.tt
  2. Model.edmx
  3. Model.tt

In Model.tt there is Model.cs file, that contains Partial classes of selected tables.

Now when I try to update the .edmx file to add a new table, Model.cs is not getting updated, it does not add the new class for newly added table.

How to update Model.cs file when any new table or update existing table in Model.edmx ?

Thanks

Upvotes: 0

Views: 351

Answers (1)

Sandy
Sandy

Reputation: 11717

This issue generally appears when our .edmx file is present in a folder in the project. Generally I was able to solve the issue by right clicking the .edmx file and then selecting Run Custom Tool option. In some cases you will need to do the same for Context.tt and .tt file also.

In few weird cases when I tried adding/editing columns of an existing table, to update the entity file, I had to open the .cs file inside the .tt file and then the run Run Custom Tool on .tt file. It almost worked every time I edited an existing table and entity files were updated successfully.

Hope it helps.

Upvotes: 1

Related Questions