title: Entity Framework - Why explicitly set entity state to modified?
body: <p>The official documentation says to modify an entity I retrieve a DbEntityEntry object and either work with the property functions or I set its state to modified. It uses the following example</p>
  
  <pre><code>Department dpt = context.Departments.FirstOrDefault();
  DbEntityEntry entry = context.Entry(dpt);
  entry.State = EntityState.Modified;
  </code></pre>
  
  <p>I don't understand the purpose of the 2nd and 3rd statement. If I ask the framework for an entity like the 1st statement does and then modify the POCO as in</p>
  
  <pre><code>dpt.Name = "Blah"
  </code></pre>
  
  <p>If I then ask EF to SaveChanges(), the entity <em>has</em> a status of MODIFIED (I'm guessing via snapshot tracking, this isn't a proxy) and the changes are persisted without the need to manually set the state. Am I missing something here?</p>