我的当前项目组织方式如下:
- Domain 层 -> 领域对象和仓库接口
- Infrastructure 层 -> 仓库实现
- Application 层 -> MVVM 模式下的服务
- Presentation 层 -> 只访问 Service 层并使用 ViewModels 进行操作
我使用了一个 IoC 容器 (SimpleInjector)。我的 Services 在构造函数中接收一个 IRepository,例如:
public CustomerService : ServiceBase
{
public CustomerService(ICustomerRepository repository, IUnitOfWork<CustomerContext> uow)
{
...
}
}
我的问题是:
为了在服务中注入一个仓库,我的表现层应该引用领域层。添加这个引用没问题吗?我的表现层难道不应该只引用基础设施和应用层吗?