开发者

Can services in the service layer communicate with each other?

I have a Service Layer, in which my Pred开发者_如何转开发ictionService needs to know if a certain Race exists. The RaceService has a method DoesRaceExist(), but I am not sure if the services can communicate.

That also leads me to some other problems. Lets say I have an Predictions.aspx page. I implement with MVP, and so when the page is first requested, the Initialize() method in the presenter runs. The Predictions.aspx needs multiple pieces of information, from predictions and from races, maybe even more. Should I ask all these pieces from their appropriate services, or should I query the database just one time and get all the information that I need in one go? The problem is then which Service to pick, and then that the service probably does more than just relaying what it is intended for.

What is the best way to go about?


If serviceA needs to get data or run a action on serviceB, it is fine to call serviceB from serviceA.

You might, however, find yourself in a situation where services call each other all over the place - if that happens, consider using a facade that orchestrates the different services (so they don't call each other directly).

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜