16
votes

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 operation.

3

3 Answers

46
votes

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.

0
votes

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.

0
votes

Add primary key, delete entity and add again in .edmx file. Clean and compile solution.