Alternatives for Translation Layer in SOA: WCF

前端 未结 2 1238
醉酒成梦
醉酒成梦 2020-12-06 22:11

Services are not object-oriented. Suppose I have a OOAD based design. We can convert it into DTO (that does not have any behavior) using a Translation Layer

相关标签:
2条回答
  • 2020-12-06 22:38

    Check out Automapper, we are using this for the same task.

    0 讨论(0)
  • 2020-12-06 22:43

    As with everything else in software development (and particularly architecture), there's not a single, correct answer to those questions. It depends upon the architectural goals and constraints.

    WCF works with DTOs. While it's possible to drop down to a more primitive layer and work directly with messages, for all practical concerns, DTOs are a fundamental part of working with WCF. Since WCF seems to be one of the architectural constraints in this case, there's really no practical way to avoid DTOs.

    The question then becomes: should there be a mapping layer or not?

    That question is fairly easy to answer if we can answer another question: mapping from what?

    If you already have an existing system, you'd need to translate between the existing system and the WCF boundary. In such a case, a translation layer is required.

    If you are building a completely new system, perhaps it'll be easier not to translate.

    0 讨论(0)
提交回复
热议问题