Search⌘ K
AI Features

Entity and View Model

Explore the roles of entity and view models within the MVC pattern to effectively manage data representation and display. Learn to integrate EF Core for accessing database entities and create view models for rendering data in web views. Understand how to structure these models and configure your ASP.NET Core project to build responsive and maintainable web applications.

In MVC, the M stands for the model. Models represent the data required to respond to a request. There are two types of models commonly used:

  • Entity models

  • View models

Entity models

Entity models represent entities in a database like SQL Server or SQLite. Based on the request, one or more entities might need to be retrieved from data storage. Entity models are defined using classes since they might need to change and then be used to update the underlying data store.

View models

All the data that we ...