[Solved] Error 3027: No mapping specified for the following EntitySet/AssociationSet [closed]
I am using EntityFramework 6 and I used
Update Model from
Database after inserting table in the database, I got above error.Please state how to overcome this problem.
Open the edmx file on notepad, find the unmapping association and remove it. It
Not too satisfying, but I solved it by removing and re-adding the model:
- Right-click on edmx-diagram and select “Model browser”
- Remove the entity type that’s giving the problems
- Save (just to be sure, regenerates files)
- Add model from databasetable again and save.
The warning was gone afterwards.
I got the same error and found that the foreign key in the table I had added was not of the same type as in the referenced table.
Here how I fix this:
- Remove all the entities in your Diagram in your edmx file.
- Rebuild your project if this edmx file is part of a project in your solution.
- Rebuild your solution.
I am not sure why this happens but on my part, it consistently triggers this error when I update my database, and I didn’t update my edmx file.
Try removing entity (table) from EDMX then run update to add that table again.
Sometimes there is the problem in Entity Framework when we update tables then other objects like SP’s automatically refreshed. Please make sure this was not happened in your case. Other thing you can try – replace model.tt file with new one, to achieve this,
- Right click anywhere in your edmx file.
- Select “Add code generation item”.
- Choose “EF 6.x EntityObject Generator”.
- Change name from “Model2.tt” to “Model1.tt”(if your old model file name was model1.tt).
- Click Add.
Remove and then re-add the tables to the EDMX to fix the mapping issue.
It may happen if you’ve tried many times to update your model from the database, and there are conflicting changes.
If you’re using git, discard the changes in the edmx file, or roll back to a previous version.
Then right click on the edmx file in Visual Studio > Update model from database
Select the new tables/views you want to include, otherwise it will simply refresh > Finish