Warum erhalte ich die Fehlermeldung "Kann EntitySet nicht aktualisiert werden, weil es eine DefiningQuery ..." Ausnahme hat, wenn versucht wird, ein Modell in Entity Framework zu aktualisieren?

Während der Aktualisierung mit Hilfe von LINQ to SQL mit Entity Framework, wird eine Ausnahme geworfen.

System.Data.UpdateException: Unable to update the EntitySet 't_emp' because it has 
a DefiningQuery and no <UpdateFunction> element exists in the   
<ModificationFunctionMapping>

Den code für das update ist :

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)
        {

        }
    }

Warum bin ich immer diese Fehlermeldung?

InformationsquelleAutor der Frage Thomas Mathew | 2011-07-21

Schreibe einen Kommentar