Entity Framework error - Error 11009: Property ' ' is not mapped
Solution 1:
Check the xml file of your model, it's probably still in there somewhere. Try deleting it manually from that XML file, then try to update again. Be sure to take backups though.
Solution 2:
I had this issue when I changed a column name from CampaignKey
to CampaignCode
. After making the DB change, I went to the .edmx
designer, right clicked and chose Update Model from Database. Then when I compiled I got the error:
Error 11009: Property
CampaignKey
is not mapped.
Taking a closer look at my table in the designer showed me that Visual Studio had created the new field CampaignCode
as in the DB. But it also had left the old field CampaignKey
in there, causing the error as it no longer exists in the DB.
To fix the issue, I right-clicked on the CampaignKey
field in my table in the designer and selected Delete.
After that I saved the .edmx
, compiled and the error was gone.
Solution 3:
I have gotten this same error before when column names on tables or views change case. For example, if a view has a column named "OrderID" and then the column name is changed to "OrderId" then it will give the error 'Property "OrderID" is not mapped'. This can be resolved by changing the case back to how it exists in the model.
Solution 4:
At times, upgrading a project throws up errors.
Just make sure you have backed up all your data, just-in-case.
When we add entity model into our project, it adds a corresponding connection string to web.config. Now, when you delete the model from project, even then the connection string still resides there in the web.config.
So, take the following steps:
- Delete the model
- Delete the corresponding connection string from web.config
- Now, perform the steps to add the model again from scratch.
Hopefully, it should work.