且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

什么是在SOA应用程序中使用的DTO的***方式?

更新时间:2023-02-17 20:38:26

忘记所有关于数据层。创建DTO:■对于每个特定的Web服务调用工作。

Forget all about the data layer. Create DTO:s that works for each specific web service call.

这不是重要的DTO如何被建立或如何使用它。唯一重要的事情是,他们是如何设计,以尽量减少Web服务调用每个操作的数量。

It's not important how the DTO is built or how it's used. The only thing that matters is how they are designed to minimize the amount of webservice calls for each operation.

例如:假设你有,你需要遍历所有用户修改其地址的用例。一个不好的设计是,如果你首先需要获取所有用户,然后作出一个Web服务调用为每个用户获取它的地址。适当的设计将返回 UserWithAddress DTO的列表:在一个单一的通话S9

For instance: Let's say that you have a use case where you need to traverse all users to to modify their addresses. A bad design would be if you first need to fetch all users and then make a webservice call for each user to fetch it's address. A proper design would be to return a list of UserWithAddress DTO:s in a single call.