Hirdetés

Új hozzászólás Aktív témák

  • Keem1

    veterán

    Srácok, EntityFramework, lekérek egy entry-t a DB-ből, pár property-t módosítok, majd save-elném, de hiba jön.

    var existing = db.SpotifyUsers.Where(x => x.Username == userdata.Id).SingleOrDefault();
    db.Entry(existing).CurrentValues.SetValues(edited);

    Erre kapom azt, hogy:
    The property 'SpotifyUser.Id' is part of a key and so cannot be modified or marked as modified. To change the principal of an existing entity with an identifying foreign key, first delete the dependent and invoke 'SaveChanges', and then associate the dependent with the new principal.

    Hogy tudnám megmondani neki, hogy az Id-t hagyja békén, ne akarja módosítani (én se teszem, nincs ilyen property az edited-ben)? :R

Új hozzászólás Aktív témák