title: Entity Framework 6 dbContext not saving changes
body: <p>In our MVC 5 project our database context is instantiate in the <code>AccountController</code> like this</p>
  
  <pre><code>    private CustomersContext _customersContext;
  
      public CustomersContext CustContext
      {
          get
          {
              return _customersContext ?? new CustomersContext();
          }
          private set
          {
              _customersContext = value;
          }
      }
  </code></pre>
  
  <p>Each customer is referred by a number of sources. The routine below changes the UserId of the referral source to a new user.</p>
  
  <pre><code>        var referralList = CustContext.Referrals.Where(d =&gt; d.UserId == membershipUser.Id);
          foreach (Referral referral in referralList)
          {
              referral.UserId = newUser.Id;
          }
  </code></pre>
  
  <p>Stepping trough the code I can see <code>referral.UserId</code> being updated. However</p>
  
  <pre><code>var result = await CustContext.SaveChangesAsync();
  </code></pre>
  
  <p>returns 0. The database is not updated.</p>
  
  <p><code>CustomersContext</code> looks like this</p>
  
  <pre><code>{
  public partial class CustomersContext : IdentityDbContext&lt;ApplicationUser&gt;//, ICustomersContext
  {
  
      public CustomersContext()
          : base("DefaultConnection", throwIfV1Schema: false)
      {
      }
  
      public static CustomersContext Create()
      {
          return new CustomersContext();
      }
  
      public virtual DbSet&lt;ReferralSource&gt; ReferralSources { get; set; }
          protected override void OnModelCreating(DbModelBuilder modelBuilder)
      {
          base.OnModelCreating(modelBuilder);
  
          modelBuilder.Entity&lt;ApplicationUser&gt;()
              .HasMany(e =&gt; e.Referrals)
              .WithRequired(e =&gt; e.User)
              .HasForeignKey(e =&gt; e.UserId)
              .WillCascadeOnDelete(false);
  </code></pre>
  
  <p>I don't see any sql emitted in SQL Profiler. Why doesn't the database context save changes?</p>