开发者

How to avoid trying to update a view in the Entity Framework

I have an Entity Framework project, and it imports a read-only view as one of the entities. This view is related to other entities, and when I attempt to update those entities, it tries to update the view also. I get the error:

Unable to update the EntitySet 'vw_Consumer' because it has a DefiningQuery and no element exists in the element to support the current operation

开发者_运维问答

How can I tell the entity framework to not to try to update that entity?

Thanks.


You could always implement insert & update stored procedure for the table that corresponds to the read only view and then configure EF to use the stored procedures. Then you simply perform no action in the stored procedures.

Here is an example of using stored procedures with EF.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜