title: How change tracking works in Entity Framework
body: <p>Given the following code, how does EF/DbContext knows about the change made to the <strong>customer</strong> object:</p>
  
  <pre><code>class Program
  {
      static void Main()
      {
          using(var shopContext = new ShopContext())
          {
              var customer = shopContext.Customers.Find(7);
  
              customer.City = "Marion";
  
              customer.State = "Indiana";
  
              shopContext.SaveChanges();
          }
      }
  }
  
  public class ShopContext : DbContext
  {
      public DbSet&lt;Customer&gt; Customers { get; set; }
  }
  
  public class Customer
  {
      public int Id { get; set; }
      public string FirstName { get; set; }
      public string LastName { get; set; }
      public string City { get; set; }
      public string State { get; set; }
  }
  </code></pre>
  
  <p>Thank you</p>