Learn

The EF diagram now shows how data is saved from the browser to the database:

  • The user makes changes to existing data or adds new data
  • The data is sent to the Razor page with a POST method that usually is triggered by a button click
  • The Razor page parses the data fields from the <form> POST and assigns it to a member variable
  • The variable is merged into the EF context DBSet using Add() for a new record, Attach() for an update, and Remove() for a deletion
  • Each of these three context methods generate the SQL statements necessary to complete the task
  • The SQL is sent to the database so the data can persist

Sign up to start coding

Mini Info Outline Icon
By signing up for Codecademy, you agree to Codecademy's Terms of Service & Privacy Policy.

Or sign up using:

Already have an account?