title: EF Entity Can not be updated or deleted
body: <p>I am building a Task management ( day to day task management, not system tasks).</p>
  
  <p>Here is my <code>TaskListEntity</code> - in this table <code>TaskId</code> is the PK</p>
  
  <pre><code>public partial class TaskList
  {
  
      public int TaskId { get; set; }
      public int UserID { get; set; }
      public string TaskType { get; set; }
      public string TaskNote { get; set; }
      public string HandlerId { get; set; }
      public int Priority { get; set; }
      public Nullable&lt;System.DateTime&gt; DueDate { get; set; }
      public Nullable&lt;int&gt; Remind { get; set; }
      public string TaskSubType { get; set; }
      public bool Completed { get; set; }
      public string TaskDescription { get; set; }
      public string HandlerId2 { get; set; }
      public string HandlerId3 { get; set; }
      public string HandlerId4 { get; set; }
  
      public virtual User User { get; set; }
  }
  </code></pre>
  
  <p>When user ticks Completed, I want to update the instance so I did this</p>
  
  <pre><code>UnitOfWork uow = new UnitOfWork();
  TaskList task = uow.Tasks.GetAll().Where(t =&gt; t.TaskId == taskId).FirstOrDefault();
  task.Completed = true;
  
  uow.Tasks.Update(task);
  uow.Complete();
  </code></pre>
  
  <p>I'm getting this weird error</p>
  
  <blockquote>
    <p>System.InvalidOperationException: 'The property 'Completed' is part of the object's key information and cannot be modified. '</p>
  </blockquote>
  
  <p>The property <code>Completed</code> is no Key and not even a FK. I just can't think of why this is happening. What am I missing here? I even added this to see if it helps   </p>
  
  <pre><code>[Key]
  public int TaskId { get; set; }
  </code></pre>
  
  <p>Just to make sure system sees <code>TaskId</code> as the primary key not the <code>Completed</code> field. </p>
  
  <p>I have been battling with this for hours now. Can someone please help me?</p>
  
  <p>Here is the Update Method</p>
  
  <pre><code>  public void Update(TEntity entity)
      {
  
          try
          {
              Context.Entry(entity).State = System.Data.Entity.EntityState.Modified;
          }
          catch (DbEntityValidationException dbEx)
          {
              foreach (var validationErrors in dbEx.EntityValidationErrors)
              {
                  foreach (var validationError in validationErrors.ValidationErrors)
                  {
                      Trace.TraceInformation("Class: {0}, Property: {1}, Error: {2}",
                          validationErrors.Entry.Entity.GetType().FullName,
                          validationError.PropertyName,
                          validationError.ErrorMessage);
                  }
              }
          }
  
  
      }
  </code></pre>