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.
链接地址: http://www.djcxy.com/p/64922.html上一篇: 实体框架4.2:无PK的表的InsertFunction
下一篇: 如何避免尝试更新实体框架中的视图