What is the life cycle of an HTTP request in MVC standards?

2

I've been developing in ASP.NET MVC5 for 1 year and 2 months, and until today I can not figure out who's calling. Searching further, I found this answer that says (in free translation):

  

Life cycle of an HTTP request:

     

The user makes the HTTP request;

     

The controller intercepts;

     

The controller calls the appropriate service;

     

The service calls the appropriate DAO that returns some persistent data (for example);

     

The service handles the data and returns it to the controller;

     

The controller saves the data in the model and calls the view;

     

The view populates with the model data and returns the HTTP request.

What would this service be? Currently I call static classes that do the processing, save and retrieve data from the bank, would this be the same thing as these services?

    
asked by anonymous 02.05.2018 / 16:32

1 answer

0

Service is one of the 3 layers of the application

The question you posted as a reference to your question, calls the "service" the middle tier of the application. This intermediate layer is described within a 3-tier architecture (data, services, presentation) where the service layer would have the code that accesses the data layer, applies business rules and returns to the display layer the user .

The response puts the MVC inside the presentation layer. The call made to the controller, passes to the service layer that calls the data layer (DAO), treats that data and applies business rules, and returns to continue and be directed to the View, where it would be formatted (HTML) for presentation to the user.

This separation of layers is a logical separation within the system, however it is possible to have an implementation where the service layer had to be accessed through a call to an API that resides on another machine and after the return send the received data to the View.

    
02.05.2018 / 18:56