WCF contract know the domain

↘锁芯ラ 提交于 2020-01-25 21:58:31

问题


I have four projects:
1. Business project that defines the business login of my project.
2. Service contract project that defines a contract interface and DTOs.
3. Service implementation project that defines an implementation to the service.
4. Web application with svc file that uses the service.

Theoretically:
A. The contract project should reference to no one.
B. The service implementation should reference the contract project and the domain.
C. The web application should reference only the contract and implementation project.

I have service like this:

AccoundData GetAccount(AccountTypeEnum type);

The problem is that AccountTypeEnum defined in the domain, so that the contract and the web application should have reference to the domain.. But this is what we are trying to prevent.. So how can I prevent from the contract of "knowing" the domain?


回答1:


In such case you contract must use different enum / DTO and your service implementation must translate between contract enum and domain enum.



来源:https://stackoverflow.com/questions/7176745/wcf-contract-know-the-domain

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!