我有一个DDD类库。其中,我有以下结构:DDD服务和WCF服务有什么区别?
> Core
> - DataAccess (my LINQ repositories)
> - Domain (my data objects)
> - Impl (my services)
我最近在我的解决方案中添加了一个WCF项目。这个项目将 暴露JSON网络方法到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;
}
这感觉不对我。我想知道是否应该删除我的Impl文件夹(所有 DDD服务)并重新编译。然后,在我的WCF项目中添加DLL作为一个推导,并将我的 先前的DDD服务编写为WCF方法?
WCF是否真的只需要Domain和DataAccess层?
在此先感谢。