title: How to update primary key from Entity Framework?
body: <p>I have Table</p>
  
  <pre><code>eventid int -- not PK key but with autoincrement
  jobid -- PK autoincrement disabled
  userid  int   -- PK autoincrement disabled
  </code></pre>
  
  <p>To update jobID I do following:</p>
  
  <pre><code>var itemforupdate = context.table.where(n=&gt;n.eventid == someparameter).FirstorDefault()
  </code></pre>
  
  <p>I get the item from database correctly, but when assigning:</p>
  
  <pre><code>itemforupdate.jobID = 5;
  context.SaveChanges();
  </code></pre>
  
  <p>after <code>context.SaveChanges()</code> I get the error:</p>
  
  <blockquote>
    <p>The property 'jobID' is part of the object's key information and
    cannot be modified</p>
  </blockquote>
  
  <p>How to update jobID from Entity Framework to solve this problem?</p>