Learn

This diagram will help you conceptualize the Entity Framework model process in action:

  • The database connection string is stored in the AppSettings.json file
  • Models are coded as C# classes that define field properties
  • The Context is also a C# class that references the connection string and model classes forming a bridge from your code to physical table storage
  • The EF Context can create the database and tables or reference an existing database
  • Razor pages use dependency injection to consume the EF context making all referenced tables available to your page model code
  • Code in the page model interacts with the EF context to pass data from the database to the page model member variables
  • This data is merged with HTML markup to create web pages that are displayed in the browser

Sign up to start coding

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