I have a table
eventid int -- not PK key but with autoincrement jobid -- PK autoincrement disabled userid int -- PK autoincrement disabled
To update the job ID:
var itemforupdate = context.table.where(n=>n.eventid == someparameter).FirstorDefault()
I get the item correctly from the database, but on assignment:
itemforupdate.jobID = 5; context.SaveChanges();
after context.SaveChanges() I get an error:
The 'jobID' property is part of the object key information and cannot be changed
How to update jobID from Entity Framework to solve this problem?
source share