title: How to update specific columns in Entity Framework 4.5?
body: <p>I have this generated entity:</p>
  
  <pre><code>    public partial class Player
      {
          public int Id { get; set; }
          public string Name { get; set; }
          public System.DateTime Birthdate { get; set; }
          public PlayerPosition Position { get; set; }
          public int IdTeam { get; set; }
  
          public virtual Team Team { get; set; }
      }
  </code></pre>
  
  <p>I want to make a method to update the position of a player.</p>
  
  <p>I am doing this:</p>
  
  <pre><code>        Player playerToUpdate = new Player
          {
              Id = 34,
              Position=PlayerPosition.Defender
          };
          playersRepository.Attach(playerToUpdate);
          playersRepository.UpdatePosition(playerToUpdate);
  
          public void Attach(T entity)
          {
              DbSet.Attach(entity);
          }
  
          public void UpdatePosition(Player playerToUpdate)
          {
              Context.Entry(playerToUpdate).Property(p =&gt; p.Position).IsModified = true;
          }
  </code></pre>
  
  <p>I get a validation exception (<em>The name field is required</em>)</p>
  
  <p>What is the way to fix it?</p>
  
  <p>Thanks.</p>