title: Entity Framework - Auditing activity
body: <p>My database has a 'LastModifiedUser' column on every table in which I intend to collect the logged in user from an application who makes a change.  I am not talking about the database user so essentially this is just a string on each entity.  I would like to find a way to default this for each entity so that other developers don't have to remember to assign it any time they instantiate the entity.</p>
  
  <p>So something like this would occur:</p>
  
  <pre><code>using (EntityContext ctx = new EntityContext())
  {
      MyEntity foo = new MyEntity();
  
      // Trying to avoid having the following line every time
      // a new entity is created/added.
      foo.LastModifiedUser = Lookupuser(); 
  
      ctx.Foos.Addobject(foo);
      ctx.SaveChanges();
  }
  </code></pre>