because it has a DefiningQuery and no element exists in the element

.net c# entity-framework

Question

I'm using EF in my application.

I try to save\insert a new record to a mapping table

and get the following error:

Unable to update the EntitySet 'UsersLimitationToCountry' because it has a DefiningQuery and no <InsertFunction> element exists in the <ModificationFunctionMapping> element to support the current operation.

Should I define it in the edmx myself? How?

1
56
3/10/2013 1:44:18 PM

Accepted Answer

My many-to-many mapping table was missing PK

added, and the issue is solved.

95
3/10/2013 3:13:49 PM

Popular Answer

Agreed with the accepted answer. Just providing the reason behind it...

When EF mapping is done with a table which does not have a primary key, it is treated as a view. Since views are logical entities, they can't be updated.

So either add the missing primary key to your table or consider them as a view & don't perform any update operation on them.



Related Questions





Related

Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow
Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow