哪种设计模式属于我的项目?
你好 我们在我的项目中使用了WCF服务。在我们的应用程序中存在以下层:
- UI(aspx 文件)和隐藏代码。 (Customer.aspx)
- UI 实体模型 (CustomerModel.cs) 这是客户的财产 细节。
- UI 层使用 CustomerModel 对象调用 Business Façade 类。
- 在业务外观中,我引用了 WCF 服务。
- 将 CustomerModel 转换为 CustomerContract。
- 从业务外观呼叫客户服务。
- 在服务中,我已将 CustomerContract 转换为 CustomerBO 并调用 CustomerBO 类。
- 在CustomerBO类中,我已经初始化了提供者对象并调用了客户提供者类。
- 在 Provider 类中,我可以访问数据库并将数据从 8 层发送到 1 层。
我不知道我们的项目中使用的是哪种设计模式。任何人都可以帮助识别设计模式吗?
谢谢
Hi
we have used the WCF service in my project. In our application the following layers are exists,
- UI (aspx file), and code behind.
(Customer.aspx) - UI entity Model (CustomerModel.cs)
which is properties of the customer
details. - UI layer calls the Business Façade class with the CustomerModel object.
- In Business façade I have referenced the WCF service.
- Convert the CustomerModel to CustomerContract.
- Call the CustomerService from business façade.
- In the service, I have convert CustomerContract into CustomerBO and call the CustomerBO class.
- In the CustomerBO class,I have initialized the provider object and call the customer Provider class.
- In Provider class, I have access the Database and send data from 8 to 1 layer.
I don't know which design pattern is using in our project. Can anybody help on this to identify design pattern.
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这不是关于设计模式,而是关于架构。您的架构本身还不错,但它确实很复杂,因此除非您正在创建非常大的项目,否则这种架构可能会太过分。此外,您对不同层的命名不正确。你所说的BusinessFacade通常被称为ServiceAgent。 BusinessFacade 应放置在服务站点上并由 WCF 服务包装。 BusinessFacade 的通常职责是将多个业务操作聚合为单个调用 = 创建粒度较小的 API,可以轻松有效地公开该 API 以供远程调用。
This is not about design pattern but about architecture. Your architecture itself is not bad but it is really complex so unless you are creating very big project this architecture can be overkill. Moreover your naming of different layers is not correct. What you call BusinessFacade is usually called ServiceAgent. BusinessFacade should be placed on service site and wrapped by WCF service. Usual responsibility of BusinessFacade is to aggregate several business operations into single calls = create less granular API which can be easily and effectively exposed for remote calls.