Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/wcf/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# DDD服务和WCF服务之间有什么区别?_C#_Wcf_Design Patterns_Domain Driven Design_Soa - Fatal编程技术网

C# DDD服务和WCF服务之间有什么区别?

C# DDD服务和WCF服务之间有什么区别?,c#,wcf,design-patterns,domain-driven-design,soa,C#,Wcf,Design Patterns,Domain Driven Design,Soa,我有一个DDD类库。其中,我有以下结构: > Core > - DataAccess ( my LINQ repositories) > - Domain ( my data objects) > - Impl (my services) 我最近在解决方案中添加了一个WCF项目。该项目将 将JSON web方法公开给iPhone客户端。WCF方法是 不太复杂-GetCustomers/GetCustomerDetails/GetAlerts GetAlertDetail

我有一个DDD类库。其中,我有以下结构:

> Core
> - DataAccess ( my LINQ repositories)
> - Domain ( my data objects)
> - Impl (my services)
我最近在解决方案中添加了一个WCF项目。该项目将 将JSON web方法公开给iPhone客户端。WCF方法是 不太复杂-GetCustomers/GetCustomerDetails/GetAlerts GetAlertDetails/GetProblems/GetProblemDetails/GetInventory/ GetInventoryDetails、GetDataPoints/GetDataPointDetails/etc

我注意到WCF中的大多数方法都是公开的 通过我的DDD模型中的我的服务层。所以,我发现自己在做什么 有很多这样的代码:

public List<Alert> GetAlerts()
{
    AlertSerice _as = new AlertService;
    List<Alert> alerts = _as.GetAlerts();

    return alerts;
}
public List GetAlerts()
{
AlertSerice _as=新的AlertService;
列表警报=_as.GetAlerts();
返回警报;
}
我觉得这不对。我想知道我是否应该放弃我的Impl文件夹(包括所有 DDD服务)并重新编译。然后,将DLL作为参考添加到我的WCF项目中,并编写我的代码 以前的DDD服务作为WCF方法

WCF真的只需要域和数据访问层吗


提前感谢。

从体系结构的角度来看,使用不同的服务层来公开数据允许对受保护的方法和内部方法进行抽象和隔离,您只需插入不同的服务处理程序(服务配置)即可以二进制或XML格式公开数据。您需要花费时间的地方是确保明确定义抽象级别,并确保实现代码访问规则和服务层公开的各层之间的安全性。

从体系结构的角度来看,使用不同的服务层公开数据允许抽象级别,对于受保护的方法和内部方法,您只需插入不同的服务处理程序(服务配置)即可以二进制或XML格式公开数据。您需要花费时间的地方是确保明确定义抽象级别,并确保实现代码访问规则和服务层公开的层之间的安全性。

AlertSerice\u as=new AlertService;
AlertSerice _as = new AlertService;
List<Alert> alerts = _as.GetAlerts();
列表警报=_as.GetAlerts();
您可能使用的域服务不正确

在DDD中,当一个操作必须涉及多个聚合根时,使用域服务

GetAlerts显然是属于AlertRepository的功能(不仅属于AlertRepository,而且是该存储库的核心功能)

至于WCF服务,它们是公共端点。他们的工作是接收来自客户端的请求,并对域或查询执行命令。这类服务的重点通常是转换——从原始类型的输入参数到用于输出的DTO; 列表警报=_as.GetAlerts(); 您可能使用的域服务不正确

在DDD中,当一个操作必须涉及多个聚合根时,使用域服务

GetAlerts显然是属于AlertRepository的功能(不仅属于AlertRepository,而且是该存储库的核心功能)

至于WCF服务,它们是公共端点。他们的工作是接收来自客户端的请求,并对域或查询执行命令。这类服务的重点通常是转换——从原语类型的输入参数到用于输出的DTO