p>
This also leads to some other questions. Suppose I have a Predictions.aspx page. I use MVP implementation, so when the page is requested for the first time, the Initialize() method in the presenter runs. Predictions.aspx requires multiple Information, including predictions and matches, and maybe even more. Should I ask all these parts from their appropriate service, or should I only query the database once and get all the information I need at once? The question is which service to choose, and then the service may be more than just the purpose of relaying it.
What is the best way?
However, you may find yourself in a situation where services call each other – if this happens, consider using a facade to coordinate different services (so they don’t call each other directly).
p>
I have a service layer, and my PredictionService needs to know whether a certain Race exists. RaceService has a method DoesRaceExist(), but I am not sure whether the service can communicate.
This also leads to some other questions. Suppose I have a Predictions.aspx page. I use MVP implementation, so when the page is requested for the first time, the Initialize() method in the presenter runs. Predictions.aspx needs Multiple pieces of information, including predictions and matches, and maybe even more. Should I ask all these parts from their appropriate service, or should I only query the database once and get all the information I need at once? The question is which service to choose, and then the service may be more than just the purpose of relaying it.
What is the best way?
If serviceA needs to get data or run operations on serviceB, you can call serviceB from serviceA.
However, you You may find yourself in a situation where services call each other-if this happens, consider using facade to coordinate different services (so they don’t call each other directly).