title: Entity tracking in Entity Framework
body: <p>I started reading more about EF. I believed that entities are tracked as long as the context is in scope. But when I try the code below, I get different results. The context has gone out of scope but the entity state still get changed from Unchanged to Modified. Did I misunderstood what I read? Can someone please explain.</p>
  
  <pre><code>Destination canyon;
  DbEntityEntry&lt;Destination&gt; entry;
  
  using (var context = new BreakAwayContext())
  {
      canyon = (from d in context.Destinations.Include(d =&gt; d.Lodgings)
                      where d.Name == "Grand Canyon"
                      select d).Single();
      entry = context.Entry&lt;Destination&gt;(canyon);
  }
  
  //Context gone out of scope
  Console.WriteLine(entry.State); //Unchanged
  canyon.TravelWarnings = "Carry enough water!";
  Console.WriteLine(entry.State); //Modified
  </code></pre>