title: Use of AsNoTracking in ASP.Net Core docs
body: <p>I've been trying to understand the use of AsNoTracking when editing an entity in the following code from ASP.Net Core docs, found <a href="https://github.com/aspnet/Docs/blob/master/aspnetcore/security/authorization/secure-data/samples/final2/Pages/Contacts/Edit.cshtml.cs" rel="nofollow noreferrer">here</a>:</p>
  
  <pre><code>public async Task&lt;IActionResult&gt; OnPostAsync(int id)
  {
      if (!ModelState.IsValid)
      {
          return Page();
      }
  
      // Fetch Contact from DB to get OwnerID.
      var contact = await Context
          .Contact.AsNoTracking()
          .FirstOrDefaultAsync(m =&gt; m.ContactId == id);
  
      if (contact == null)
      {
          return NotFound();
      }
  
      var isAuthorized = await AuthorizationService.AuthorizeAsync(
                                               User, contact,
                                               ContactOperations.Update);
      if (!isAuthorized.Succeeded)
      {
          return new ChallengeResult();
      }
  
      Contact.OwnerID = contact.OwnerID;
  
      Context.Attach(Contact).State = EntityState.Modified;
  
      …
  
      await Context.SaveChangesAsync();
  
      return RedirectToPage("./Index");
  }
  </code></pre>
  
  <p>The summary for AsNoTracking states:</p>
  
  <blockquote>
    <p>Disabling change tracking is useful for read-only scenarios because it
    avoids the overhead of setting up change tracking for each entity
    instance. You should not disable change tracking if you want to
    manipulate entity instances and persist those changes to the database
    using Microsoft.EntityFrameworkCore.DbContext.SaveChanges.</p>
  </blockquote>
  
  <p>Clearly this isn't a read-only scenario and the only reason this method is running is to attempt to update the entity in the database.</p>
  
  <p>Is there an explanation for why this code seems to be going against the advice given in the AsNoTracking summary?</p>