Unable to update the EntitySet 'ItemRankList' because it has a DefiningQuery and no <UpdateFunction> element exists
Any ideas why does the entity framework in LINQ gives following strange error:
Unable to update the EntitySet 'ItemRankList' because it has a DefiningQuery and no element exists in the element to support the current ope开发者_开发技巧ration.
Guess i should also ask the context... how are you using linq?
Do you have a primary key defined on the table ?
If not add the key and update the EF model.
Agreed with the accepted answer. Just providing the reason behind it...
When EF mapping is done with a table which doesnot have Primary key, it is considered as a view & views being logical enity, cant be updated.
So either add the missing primary key in ur tables or consider them as View & dont perform any update operation on them.
Add primary key, delete entity and add again in .edmx file. Clean and compile solution.
精彩评论