在使用Entity Framework的LINQ to sql的帮助下更新时,抛出异常。
- System.Data.UpdateException: Unable to update the EntitySet 't_emp' because it has
- a DefiningQuery and no <UpdateFunction> element exists in the
- <ModificationFunctionMapping>
更新的代码是:
- public void Updateall()
- {
- try
- {
- var tb = (from p in _te.t_emp
- where p.id == "1"
- select p).FirstOrDefault();
- tb.ename = "jack";
- _te.ApplyPropertyChanges(tb.EntityKey.EntitySetName,tb);
- _te.SaveChanges(true);
- }
- catch(Exception e)
- {
- }
- }
为什么我收到此错误?