title: Attach for Update Entity Framework
body: <p>I am trying to do an update for a table using EF 5.x using attach. this table has other fields that are required but its an existing row. so i am trying to update without any fetch. userid is the primary key for the table. i am trying to update the status. but it throws an EntityValidationErrors saying password is required which is another required field but not primary key. since this is a update to existing row why do you need to provide the requried fields for update? </p>
  
  <pre><code>    var webUser = new WebUser() { UserId = webUserId, OnlineStatus = (sbyte)status };
      using (var dbxupdate = new xEntities())
      {
          try
          {
              dbxupdate.WebUsers.Attach(webUser);
  dbxupdate.Entry(webUser).State = EntityState.Modified;
              dbxupdate.Entry(webUser).Property(x =&gt; x.OnlineStatus).IsModified = true;
              dbxupdate.SaveChanges();
          }
          catch (DbEntityValidationException dbEx)
          {
              foreach (var validationErrors in dbEx.EntityValidationErrors)
              {
                  foreach (var validationError in validationErrors.ValidationErrors)
                  {
                      Trace.TraceInformation("Property: {0} Error: {1}", validationError.PropertyName, validationError.ErrorMessage);
                  }
              }
          }
      }
  </code></pre>