开发者

Unable to update the EntitySet 'ItemRankList' because it has a DefiningQuery and no <UpdateFunction> element exists

开发者 https://www.devze.com 2022-12-25 00:25 出处:网络
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 noelement exists in theelement to su

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号