开发者

How to map association for Navigation property to select but not update?

开发者 https://www.devze.com 2023-03-04 22:07 出处:网络
I have a navigation property of an entity mapped to another table (a \"link table\" to enabled a many to many relationship).

I have a navigation property of an entity mapped to another table (a "link table" to enabled a many to many relationship).

This selects the data into the navigation property.

To update it I have written an SP to update this link table, which now exists in Function Imports in the model, which I can call, as it is exposed on the context.

However, updating the entity and saving causes an exception: Unable to update the EntitySet 'setName' because it has a开发者_开发技巧 DefiningQuery and no element exists in the element to support the current operation., since I have not mapped a function for Insert as I am calling my imported function on the context.

Is there a way to update the entity's Association to only select from the link table and leave the update/insert to handled by other code?


This has been solved by mapping the link table to an entity in the EDM, associating it appropriately (with Navigation properties), including the SP in the EDM, mapping the SP to the Insert function and unit testing.

Seems to be happy.

0

精彩评论

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