Learn

The EF diagram now includes additional steps to accommodate data validation:

  • Notations are made in the model classes that tailor each field for type, display, length, and regex patterns
  • The model hints alter the database schema so the data has proper constraints
  • The model hints are also used by the context to determine if any data changes are valid
  • The model hints also interact with JavaScript validation scripts that display helpful information on the browser page when data is changed by the user
  • The JavaScript validation scripts will restrict a <form> POST if the data does not match the model hints
  • Once the requested changes are marked as valid, the context method SaveChangesAsync() passes the data to the database by way of SQL statements
  • The database constraints created by the context via the model hints further restrict inserts, updates, and deletes using SQL referential techniques

Sign up to start coding

By signing up for Codecademy, you agree to Codecademy's Terms of Service & Privacy Policy.
Already have an account?