WCF服务设计模式
我想创建一个 WCF 服务。做到这一点的最佳设计模式是什么? 例如三个独立的项目,如下所示:
1)DataContract
2) 业务逻辑
3) SvcHost项目
I want to create a WCF service. What is the best design pattern to do this?
For example three seperated projects like this:
1) DataContract
2) BusinessLogic
3) SvcHostProject
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
这听起来并不太糟糕,尽管我可能会将 DataContract 和 SvcHostProject 结合起来,因为它们都必须引用 WCF 二进制文件,并且似乎共享相同的粗粒度责任(也就是说,除非您正在考虑创建一个通用服务主机)。
您可能想查看有关使 WCF 服务更具可测试性的(旧)帖子:http://blogs.msdn.com/b/ploeh/archive/2008/07/12/an-overview-of- unit-testing-duplex-wcf-services-and-clients.aspx 虽然它讨论的是双工服务,但您也可以轻松推断出如何处理更多“正常”请求响应服务。
That doesn't sound too bad, although I'd probably combine the DataContract and the SvcHostProject as they would both have to reference the WCF binaries and seem to share the same coarse-grained responsibility (that is, unless you are thinking about creating a general-purpose ServiceHost).
You might want to see the (old) post about making WCF services more testable: http://blogs.msdn.com/b/ploeh/archive/2008/07/12/an-overview-of-unit-testing-duplex-wcf-services-and-clients.aspx Although it talks about duplex services, you can easily extrapolate how to deal with more 'normal' request-response services as well.
这篇文章对我帮助很大 http ://www.netfxharmonics.com/2008/11/Architectural-Overview-Creating-Streamlined-Simplified-yet-Scalable-WCF-Connectivity
This article helped me a lot http://www.netfxharmonics.com/2008/11/Architectural-Overview-Creating-Streamlined-Simplified-yet-Scalable-WCF-Connectivity