title: Changing Entity's State in Entity Framework 4.1
body: <p>Let say we have a Customer object which has an Order object. The Order object has OrderDetail object.</p>
  
  <pre><code>Customer oCustomer 
  using(var context = new MyContext)
  {
  oCustomer = context.Include("Order.OrderDetail").Find(1);
  }
  oCustomer.Name ="blah blah";
  oCustomer.Order.Description = "blah blah";
  oCustomer.Order.OrderDetail.Quantity = 10;
  </code></pre>
  
  <p>Now when I change the state of Customer as following:</p>
  
  <pre><code>using(var context = new MyContext)
  {
      context.Entry(oCustomer).State = EntityState.Modified.
      context.SaveChanges();
  }
  </code></pre>
  
  <p>This saves only oCustomer object and not the Order and OrderDetail that are in oCustomer. Since context.Entry(oCustomer).State = EntityState.Modified changes state of oCustomer only and not the Order and OrderDetail. Currently, I have to change the state of each entity in the ObjectGraph manually so that the changes are saved. Is there any way to change the state of whole ObjectGraph instead of just the parent entity? Is there any extension method or any other way out to do that?</p>