开发者

How to update tables from a View using Linq to Entities

开发者 https://www.devze.com 2023-03-15 19:29 出处:网络
I have a View in an SQL Server Database, which involves many different tables. I am using Linq to Entities to access the database, so I have no problem getting 开发者_运维知识库and showing view\'s res

I have a View in an SQL Server Database, which involves many different tables. I am using Linq to Entities to access the database, so I have no problem getting 开发者_运维知识库and showing view's result.

But the problem is when I want to modify some field in those results. As long as a view doesn't have a primary key, the Entity is read-only, so the question is:

Is there any way to modify the object with the view's data and save those changes in the corresponding tables?

Sorry for my english, but it's not my native language.

Thank you very much in advance!


There are some requirements for VIEW to be updatable. Take a look here. You say your view references many tables, so you have to implement INSTEAD OF trigger.

0

精彩评论

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