title: ASP.NET web application + Entity Framework 4.0 with Concurrency Check
body: <p>I have an entity like this:</p>
  
  <pre><code>public class Player
  {
      [Required]
      [Key]
      public int Id { get; set; }
      [Required]
      public string FirstName { get; set; }
      public string LastName { get; set; }
      public string NativeCountry { get; set; }
      [ConcurrencyCheck]
      public DateTime LastModified { get; set; }
      public virtual int TeamId { get; set; }
  
      //navigational property
      public virtual Team Team { get; set; }
      public virtual ICollection&lt;Tournament&gt; Tournaments { get; set; }
  }
  </code></pre>
  
  <p>this is how i configure Player entity:</p>
  
  <pre><code>public PlayerConfiguration()
  {
      Property(e =&gt; e.Id).IsRequired();
      Property(e =&gt; e.FirstName).IsRequired().IsConcurrencyToken(true);
      Property(e =&gt; e.NativeCountry).IsOptional();
      Property(e =&gt; e.LastModified).IsOptional().IsConcurrencyToken(true);
  
      HasRequired(e =&gt; e.Team).WithMany(s =&gt; s.Players).HasForeignKey(f =&gt; f.TeamId);
  }
  </code></pre>
  
  <p>overridden OnModelCreating</p>
  
  <pre><code>protected override void OnModelCreating(DbModelBuilder modelBuilder)
  {
      Configuration.ValidateOnSaveEnabled = false;
      Configuration.LazyLoadingEnabled = true;
  
      modelBuilder.Configurations.Add(new PlayerConfiguration());
      modelBuilder.Configurations.Add(new TeamConfiguration());
      modelBuilder.Configurations.Add(new TournamentConfiguration());
  
      modelBuilder.Entity&lt;Player&gt;().ToTable("Player");
      modelBuilder.Entity&lt;Team&gt;().ToTable("Team");
      modelBuilder.Entity&lt;Tournament&gt;().ToTable("Tournament");
  
      base.OnModelCreating(modelBuilder);
  }
  </code></pre>
  
  <p>somewhere I do this to update a player:</p>
  
  <pre><code>db.Entry&lt;Player&gt;(player).State = System.Data.EntityState.Modified;
  try
  {
      db.SaveChanges();
  }
  catch (DbUpdateConcurrencyException ex)
  {
  
  }
  </code></pre>
  
  <p>when I try to update any given player at the same time, using two browsers, nothing happens. I don't want to use a TimeStamp annotation, because it will cost me one extra 
  column. How can I use the existing <code>DateTime LastModified</code> column to track concurrency.
  I even tried making FirstName (and others) as ConcurrencyToken, but again nothing happened.
  How does this <code>[ConcurrencyCheck]</code> work in asp.net web application.??
  please help..</p>