Data Flow with Respect to a Model

The following block diagram shows the data flow in an ASP.NET MVC application:

The two important aspects of data flow are as flows:

We can use the Model as-is in our views to get data or to present it. In some views, you might not need all the properties of the model. So, instead of sending the entire model to the view, we create models specific to the view and use them in our view. This makes things simpler.

The following is the high-level sequence of events that happens when you store or retrieve a record in ASP.NET Core using the model:

  1. Users enter the data in a form (created using views) in the application. The fields in the form do not need to represent the complete model as we need only a few properties in the model.
  2. The entered data is passed to the controller where Model binding happens. Model binding is the process where the data entered in the view gets mapped to the model or ViewModel.
  1. If the data is received in the ViewModel, then we will be converting the ViewModel to the model.
  2. Finally, the model data is stored in the data source.
Until now, we have been handling only in-memory data in our application. In almost all real-world applications, some form of the database will be used for data storage, access, and retrieval. In the next section, we will discuss Entity Framework (ORM framework), which makes data access simpler from a .NET application.