title: How do I remove an asp.net identity user when constraints have been placed on the table?
body: <p>In this <code>ActionResult</code> I am deleting users from my ASP.NET Users table.</p>
  
  <pre><code>public ActionResult Delete(string UserName)
  {
      var thisUser =
      _context.Users.FirstOrDefault(u =&gt; u.UserName.Equals(UserName, StringComparison.CurrentCultureIgnoreCase));
      _context.Users.Remove(thisUser);
      _context.SaveChanges();
      return RedirectToAction("Index");
  }
  </code></pre>
  
  <p>However when I try to delete a user I get the following error:</p>
  
  <p><strong>The DELETE statement conflicted with the REFERENCE constraint "FK_dbo.UserLogs_dbo.AspNetUsers_Customer_Id". The conflict occurred in database "MYDATABASE", table "dbo.UserLogs", column 'Customer_Id'.
  The statement has been terminated.</strong></p>
  
  <p>I know that the constraints are put there to prevent data corruption and this is fine, but how would I go about removing the constraints just enough for me to remove the user and then add them back after the user is removed?</p>