Architecture 多层体系结构-责任问题
我正在开发一个实现多层模式的应用程序,其中 MySQL用于持久性。有一个提供访问权限的WCF服务 提供数据和DTO 此外,我计划实现以下模式: -DTOs -MVP(不确定是被动查看还是监控控制器) -适用时针对接口的代码 目前,我的项目结构如下:Architecture 多层体系结构-责任问题,architecture,domain-driven-design,dto,n-tier-architecture,multi-tier,Architecture,Domain Driven Design,Dto,N Tier Architecture,Multi Tier,我正在开发一个实现多层模式的应用程序,其中 MySQL用于持久性。有一个提供访问权限的WCF服务 提供数据和DTO 此外,我计划实现以下模式: -DTOs -MVP(不确定是被动查看还是监控控制器) -适用时针对接口的代码 目前,我的项目结构如下: +-------------------------------+ | MySQL DB Server | +------+------------------------+ ^ | Uses
+-------------------------------+
| MySQL DB Server |
+------+------------------------+
^
| Uses Entity Framework 5.0
|
+
+-------------------------------------------------------------------------------+
| Application Server |
|-------------------------------------------------------------------------------|
|+------------------+ +----------------+ +--------------+ +--------------------+|
|| Data Access Layer| | Contracts | | Communication| | Business Layer ||
||------------------| |----------------| |--------------| |--------------------||
|| - EF 5.0 Entities| | - WCF Contracts| | - WCF Service| | - Actual Service ||
|| | | | | Hosts | | - Session management|
|| | | | | | | - Security and ||
|+------------------+ +----------------+ +--------------+ +--------------------+|
+-------------------------------------------------------------------------------+
^
| Communicates via DTOs which are acutally wrappers for Entities
| eg. GetUserByID() or SaveUser(userDTO)
|
|
+-------+-----------------------------------------------------------------------+
| Clients |
|-------------------------------------------------------------------------------|
|+-------------------+ +-------------------+|
|| Business Layer |+----------------------------------->| GUI (Winforms) ||
||-------------------| BLL receives DTOs and creates |-------------------||
|| -Provide WCF Servi| Domain Objects (eg. User) which are| -Implementation of||
|| ce Access | Processed by presenters and passed | View Interfaces ||
|| -Service Reference| to views where they are bound to | ||
|| -Implementation of| controls. | ||
|| Presenter Interf.| | ||
|+-------------------+ +-------------------+|
+-------------------------------------------------------------------------------+
+------------------------------------------------------------------------+
| General |
|------------------------------------------------------------------------|
|+---------------------+ +--------------------+ +-----------------------+|
|| DTOs | | Interfaces | | Library ||
||---------------------| |--------------------| |-----------------------||
|| -DTO Definitions | | -View Interfaces | | -General Helper Classe||
|| | | -Presenter Interf. | | s eg. Cryptography ||
|| | | -Domain Model IF. | | ||
|+---------------------+ +--------------------+ +-----------------------+|
+------------------------------------------------------------------------+
外部框是Visual Studio中的项目文件夹。内盒是
C#项目
在我继续编码并在实际实现中花费更多时间之前,我只需要
我想获得一些关于我的项目结构/架构的反馈
我在思考以下问题:
问候我会一一回答 1) 这取决于应用程序的复杂性。如果您从事的是复杂领域的工作,那么遵循领域驱动设计是很好的 2) 如果您说BLL,它应该只考虑业务逻辑,而不考虑任何技术细节,如会话、安全性 3) 在服务器端有域对象是很好的。它促进了可重用性 4) 不应在外部公开域对象。DTO是更好的选择。您可以使用Automapper进行所有与映射相关的工作 5) 根据范围在每个组件中进行验证是很好的 6) DTO会更好
此外,您可以使用比WCF更高的服务堆栈,因为它是基于行业最佳实践构建的。我将逐一回答 1) 这取决于应用程序的复杂性。如果您从事的是复杂领域的工作,那么遵循领域驱动设计是很好的 2) 如果您说BLL,它应该只考虑业务逻辑,而不考虑任何技术细节,如会话、安全性 3) 在服务器端有域对象是很好的。它促进了可重用性 4) 不应在外部公开域对象。DTO是更好的选择。您可以使用Automapper进行所有与映射相关的工作 5) 根据范围在每个组件中进行验证是很好的 6) DTO会更好
此外,您还可以为stack而不是WCF提供服务,因为它是基于行业最佳实践构建的。您建议的结构与我们两年前在生产中部署的一个应用程序非常相似(经过必要的修改)。它可以工作,但是您必须仔细设计域模型,在不同的有界上下文中分离应用程序的各个方面 以下是我自己的答案: