Get the App
SLTechnology News&Howtos  ›  Development  › 

How to call multiple service methods in controller

Shulou Source: shulou.com Published: 2022-06-01 11:57:34 10月03日 Update

The knowledge of this article "how to call multiple service methods in controller" is not quite understood by most people, so the editor summarizes the following contents, detailed content, clear steps, and has a certain reference value. I hope you can get something after reading this article. Let's take a look at this "how to call multiple service methods in controller" article.

Controller calls multiple service methods

Generally speaking, service methods are transactional, so it is safe to encapsulate all operations in a service method.

If multiple service methods are called in controller, this can only be done in the case of a query.

Some problems with controller calling methods in service

A question about transaction propagation during development:

Controller calls method an in service, method a has no transaction, method a calls method b in service, method b has transaction.

Then when a method reports an error, the transaction in the b method will not be rolled back, and when the transaction commits the b method error, the transaction in the a method will be committed directly and will not be rolled back.

The above is about the content of this article on "how to call multiple service methods in controller". I believe we all have a certain understanding. I hope the content shared by the editor will be helpful to you. If you want to know more about the relevant knowledge, please follow the industry information channel.

Tags: Methods transactions multiple content articles knowledge articles questions security things values only most that is situations more steps knowledge points industries information Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Shulou Information MySQL vpn Microsoft Shulou Technology