title: The property 'name' is part of the object's key information and cannot be modified. Entity Framework
body: <p>I am trying to update a record and I get this error message after the <code>context.SaveChanges();</code></p>
  
  <blockquote>
    <p>The property 'name' is part of the object's key information and cannot be modified.</p>
  </blockquote>
  
  <p>Here is the code for the update function:</p>
  
  <pre><code> if (context.EAT_SourceNames.Any(e =&gt; e.name == newSourceName))
   {
      MessageBox.Show("Name already exists in the Database");
   }
   else
   {
      var nameToUpdate = context.EAT_SourceNames.SingleOrDefault(e =&gt; e.name == sourceName.name);
      if (nameToUpdate != null)
      {
         nameToUpdate.name = newSourceName;
         context.SaveChanges();
         RefreshDGVs();
       }
   }
  </code></pre>
  
  <p>My <code>SourceNames</code> class looks like the following:</p>
  
  <pre><code>    public EAT_SourceNames()
      {
          this.EAT_Sources = new ObservableListSource&lt;EAT_Sources&gt;();
      }
  
      public string name { get; set; }
      public string version_id { get; set; }
      public string allocation_name { get; set; }
  </code></pre>
  
  <p>I searched for similar questions, but could not find any working solution.</p>