title: Entity Framework validation with partial updates
body: <p>I'm using Entity Framework 5.0 with DbContext and POCO entities. There's a simple entity containing 3 properties:</p>
  
  <pre><code>public class Record
  {
      public int Id { get; set; }
      public string Title { get; set; }
      public bool IsActive { get; set; }
  }
  </code></pre>
  
  <p>The Title field is always unmodified, and the UI simply displays it without providing any input box to modify it. That's why the <code>Title</code> field is set to <code>null</code> when the form is sent to the server.</p>
  
  <p>Here's how I tell EF to perform partial update of the entity (<code>IsActive</code> field only):</p>
  
  <pre><code>public class EFRepository&lt;TEntity&gt;
  {
     ...
     public void PartialUpdate(TEntity entity, params Expression&lt;Func&lt;TEntity, object&gt;&gt;[] propsToUpdate)
     {
         dbSet.Attach(entity);
         var entry = _dbContext.Entry(entity);
         foreach(var prop in propsToUpdate)
             contextEntry.Property(prop).IsModified = true;
     }
  }
  </code></pre>
  
  <p>and the call:</p>
  
  <pre><code>repository.PartialUpdate(updatedRecord, r =&gt; r.IsActive);
  </code></pre>
  
  <p>Calling <code>SaveChanges</code> method, I get the <code>DbEntityValidationException</code>, that tells me, <code>Title</code> is required. When I set <code>dbContext.Configuration.ValidateOnSaveEnabled = false</code>, everything is OK.
  Is there any way to avoid disabling validation on the whole context and to tell EF not to validate properties that are not being updated?
  Thanks in advance.</p>