title: How to update one field of specific records using Entity Framework?
body: <p>I want update family of a person who his name is pejman.
  This is my object Class:</p>
  
  <pre><code>public class Person
  {
      public int Id { get; set; }
      public string FirstName { get; set; }
      public string LastName { get; set;}
      public DateTime BirthDate { get; set; }
      public bool IsMale { get; set; }
      public byte[] Image { get; set; }
      public byte[] RowVersion { get; set; }
      public virtual Person Parent { get; set; }
      public virtual ICollection&lt;PhoneNumber&gt; PhoneNumber { get; set; }
      public virtual ICollection&lt;Address&gt; Addresses { get; set; }
      public virtual PersonInfo PersonInfo { get; set; }
  }
  </code></pre>
  
  <p>and my method for updating is: (in Program.cs)</p>
  
  <pre><code>public static void Update(string name, string family)
  {
      var _person = new Person() { FirstName = name, LastName = family };
  
      using (var newContext = new MyDbContext())
      {
          newContext.Persons.Attach(_person);
          newContext.Entry(_person).Property(X =&gt; X.LastName).IsModified = true;
          newContext.SaveChanges();
      }
  }
  </code></pre>
  
  <p>but it doesn't work! what is the problem?</p>
  
  <p>EDIT: assume that i don't know person's Id, and i just know person's name, is there any way to update person's family?</p>