问题描述
限时送ChatGPT账号..我有四个项目:
1.业务项目,定义了我的项目的业务登录.
2. 定义合约接口和DTO的服务合约项目.
3. 定义服务实现的服务实现项目.
4. 带有使用该服务的 svc 文件的 Web 应用程序.
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.
理论上:
A. 合同项目不得引用任何人.
B. 服务实现应参考合同项目和域.
C. Web 应用程序应仅引用合同和实施项目.
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.
我有这样的服务:
AccoundData GetAccount(AccountTypeEnum type);
问题是在域中定义了AccountTypeEnum
,这样合约和web应用程序就应该有域的引用..但这是我们试图阻止的..那么如何我阻止了知道"域的合同?
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?
推荐答案
在这种情况下,您的合同必须使用不同的枚举/DTO,并且您的服务实现必须在合同枚举和域枚举之间进行转换.
In such case you contract must use different enum / DTO and your service implementation must translate between contract enum and domain enum.
这篇关于WCF契约知域的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
更多推荐
[db:关键词]
发布评论