title: DbContext Entity framework Datetime.Now fields
body: <p>Have two fields with data type datetime. </p>
  
  <ul>
  <li>Added</li>
  <li>Modified</li>
  </ul>
  
  <p>When inserting new record values for both fields must be <code>System.DateTime.Now;</code> 
  but when updating only <code>Modified</code> needs to be changed.</p>
  
  <p>I can set <code>StoreGeneratedPattern</code> to <code>Computed</code> and handle <code>Modified</code> field with <code>GETDATE()</code> in database but problem is field <code>Added</code>.</p>
  
  <p>My guess is that I have to override <code>SavingChanges()</code> or something similar but don't know how.</p>
  
  <p>EDIT : What I have try so far </p>
  
  <ul>
  <li><p>Added another class in my project with fallowing code</p>
  
  <pre><code>namespace Winpro
  {
      public partial class Customer
      {
          public Customer()
          {
              this.Added = DateTime.UtcNow;
          }
      }
  }
  </code></pre>
  
  <p>but then cannot build solution </p>
  
  <p><code>Type 'Winpro.Customer' already defines a member called 'Customer' with the same parameter types</code></p></li>
  </ul>