title: Entity Framework Code First DateTime field update on modification
body: <p>I have the following entity:</p>
  
  <pre class="lang-cs prettyprint-override"><code>public class User
  {
      public int UserId { get; set; }
      public string UserName { get; set; }
      public string UserAddress { get; set; }
      public DateTime CreateDate { get; set; }
      public DateTime? UpdateDate { get; set; }
  }
  </code></pre>
  
  <p>How can I make the <code>UpdateDate</code> field of the <code>User</code> entity become the server <code>DateTime</code> on an update? That is to say, whenever an entity in the database becomes modified, the <code>UpdateDate</code> field changes to that exact date and time as well as if to say <code>UpdateDate = new DateTime(Datetime.Now.Ticks)</code> </p>