title: Entity Framework 4.1 DbContext Override SaveChanges Property Not Loading
body: <p>I used the code from the <a href="https://stackoverflow.com/questions/6156818/entity-framework-4-1-dbcontext-override-savechanges-to-audit-property-change" title="Override save changes">Override Save Changes</a> question to implement auditing in my application.  When an entity is added everything is great.  However, when an entity is modified the "CreatedOn" date is never loaded. </p>
  
  <p>It is always null, so the initial "CreatedOn" date gets removed from the database.  </p>
  
  <p>I also tried looking in the OriginalValues collection stored in the entity, and it is populated for the "ModifiedOn" date but not for the "CreatedOn" date.  Both fields are populated in the database...why would one be loaded by EF and one not be loaded?</p>
  
  <pre><code>public override int SaveChanges()
      {
          var changeSet = ChangeTracker.Entries&lt;IAuditable&gt;();
  
          if (changeSet != null)
          {
              foreach (DbEntityEntry&lt;IAuditable&gt; entry in changeSet)
              {
                  switch (entry.State)
                  {
                      case EntityState.Added:
                          entry.Entity.CreatedOn = DateTime.Now;
                          entry.Entity.ModifiedOn = DateTime.Now;
                          break;
                      case EntityState.Modified:
                          entry.Entity.ModifiedOn = DateTime.Now;
  
                          //entry.Entity.CreatedOn date always null here
                          break;
                  }
              }
          }
  
           return base.SaveChanges();
      }
  </code></pre>